In the SWT FAQ there is a question: “Why does
everything I print seem so small?” The last paragraph of the answer
reads as follows:
Unfortunately, printing is not
simply a matter of just passing in the printer GC instead of the screen GC.
Printing has to be designed into your drawing classes. You don't have
scrollbars anymore, so you have to either cut stuff off and print it on another
page, or reorganize it, or scale it down, or wrap it somehow. Maybe you want to
give some control to your users, and let them specify how many inches something
should be, or whatever - maybe give them a ruler. There is no magic bullet -
you will definitely have to give it some thought.
I’ve written an open-source printing library for SWT
that handles word wrapping, image rendering, page breaks and other printing
concerns. If you could add a second answer to the FAQ question mentioned
above, it may spark more interest in the library and help to improve what I
believe is a very useful tool for the Eclipse community:
A: An open-source printing library for SWT called
PaperClips is available on SourceForge, which handles word wrapping, image
scaling, page breaks, and document layout. Developers write code to
compose a document, and pass the document to the library to be printed.
(PaperClips is not supported by the Eclipse Foundation.)
http://sourceforge.net/projects/paperclips/
Thanks,
Matthew Hall