Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Re: SWT printing capabilities
Re: SWT printing capabilities [message #506008] Tue, 05 January 2010 18:25
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
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!
Previous Topic:Reparenting shell problem
Next Topic:SWT Browser doesnt load applets in Linux
Goto Forum:

Current Time: Sat Jul 11 08:23:35 GMT 2020

Powered by FUDForum. Page generated in 0.02075 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top