Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Printing a shell
Printing a shell [message #756442] Sun, 13 November 2011 11:28 Go to next message
Lorenzo  is currently offline Lorenzo Friend
Messages: 2
Registered: November 2011
Junior Member
Hi all, I'm lorenzo and I'm new in this forum.

I write you because I can't print with swt library.

I have a Shell with some elements I'd like to print all contents in the shell (like a printscreen). I find some examples, but at the moment I print a white paper.

the code that I insert in the click-event of a button is:

PrintDialog printDialog = new PrintDialog(shell); // "shell" is the most bigger object that contain all the items I'd like to print
PrinterData printerData = printDialog.open();
Printer printer = new Printer(printerData); 
printer.startJob("");
printer.startPage();
GC gc = new GC(printer);

printer.endPage();
gc.dispose();
printer.endJob();				
printer.dispose();


Someone can help me?!?

Thanks in advance

Lorenzo
Re: Printing a shell [message #756635 is a reply to message #756442] Mon, 14 November 2011 14:43 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,

You can find the snippets related to printing here --> http://eclipse.org/swt/snippets/#printing
You can try to print the shell in 2 steps:
1. Get the screenshot of the shell as an image
--> Snippet292
2. Print the image. Snippet133 shows printing text, you can modify it to print the image created in step1.


Lakshmi P Shanmugam
Re: Printing a shell [message #756715 is a reply to message #756635] Mon, 14 November 2011 19:06 Go to previous message
Lorenzo  is currently offline Lorenzo Friend
Messages: 2
Registered: November 2011
Junior Member
hi, thanks a lot for the answer,
it's almost like how I tried yesterday after the question Wink but I print an image. I'll trie with "printing text"

Thaks again

Lorenzo
Previous Topic:How to call a section in SWT?
Next Topic:not able to get back and forward function in browser widget
Goto Forum:
  


Current Time: Thu Apr 25 10:39:12 GMT 2024

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

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

Back to the top