Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i want to print something like this

IMAGE

TITLE

JTABLE

i know to print a jtable with the title in a messageFormat header but i dont know how to add the image

The image is a logo

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
521 views
Welcome To Ask or Share your Answers For Others

1 Answer

You might try the approach shown here. Use drawImage() instead of drawString() in your Image printable.

private static class Image implements Printable {…}
private static class Title implements Printable {…}

PrinterJob pj = PrinterJob.getPrinterJob();
Book book = new Book();
book.append(new Image(), pj.defaultPage());
book.append(new Title(), pj.defaultPage());
book.append(table.getPrintable(...), pj.defaultPage());
book.append(new EndPage(), pj.defaultPage());
pj.setPageable(book);
pj.print();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...