|Re: SWT printing capabilities [message #506008]
||Tue, 05 January 2010 18:25
| Eric Rizzo
Registered: July 2009
Copying this to the SWT group.|
On 1/4/10 12:44 AM, DougM wrote:
> Hi coders. I am confused about printing from SWT and unable to find
> documentation or examples that make clear its capacities and
> limitations. Would someone please explain, and show me to the proper docs?
> I have a partly completed application (Windows and Mac) that displays
> each page of a document as a Composite containing a complex layout of
> Text and StyledText areas. The page displayed (a Composite) is an exact
> representation of the page I need to print.
> The SWT FAQ says:
> 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.
> 1) Is there any example of how to do this correctly? All the text
> printing snippets show the text being laid out manually with
> drawString(). That approach is certainly not feasible in this case. I
> need to have Text, StyledText, and my custom layout manager do for the
> printer what they do onscreen.
> 2) "You need to recreate them (Fonts, Colors, and Images) on the printer
> before you can use them for drawing on the printer GC."
> Suppose I recreate the page from the start using a Printer instead of a
> Display, compensating for dpi, etc. Does the above statement mean that
> the page layout and its Text and StyledText areas will then be rendered
> to the printer?
> 3) There is a Control.print(GC) method, "Prints the receiver and all
> children." The only example I find of its use is Snippet292. There it is
> used to convert a Control to an image, not to print. I naively tried
> print() with a printer GC and got only a blank page with OS 10.6.2. Its
> code goes right into OS native. How exactly is print() intended to be used?
> 4) I did get a StyledText to print perfectly using its own
> print(Printer) method. But it gives no control over placement or line
> layout. So it is not usable in this situation.
> Thanks for your help getting oriented!
Powered by FUDForum
. Page generated in 0.01883 seconds