Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Printing (to printer) a ViewPart
Printing (to printer) a ViewPart [message #110212] Wed, 22 October 2008 09:31 Go to next message
Eclipse UserFriend
Originally posted by: spanprevention-nursubscriptions.gmail.com

Hi,

Is there a standard/prescribed way of printing (to a printer) a ViewPart?
I came across the following links that deal with it:

http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg02985.html
http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg00496.html

Here is my understanding as to how this may be achieved:
1. As of now, RAP does not provide any intentional support for printing
2. One way to print a ViewPart is to instantiate
org.eclipse.swt.browser.Browser. Then invoke Browser.setText(String
contentsToPrint). The argument should be the HTML that is to be printed
i.e. the ViewPart contents suitably decorated with HTML tags.

Is the above understanding correct?

What i have is a "Print" toolbar menu item. When that is clicked, a dialog
pops up that contains the above browser.

Any pointers, suggestions or code snippets to either get me back on track
(in the fairly likely event that i am off-track), or to endorse the
approach (with improvements) are greatly appreciated.

TIA,
Best Regards,
-abhi
Re: Printing (to printer) a ViewPart [message #110347 is a reply to message #110212] Thu, 23 October 2008 08:50 Go to previous messageGo to next message
Paul Norrie is currently offline Paul NorrieFriend
Messages: 51
Registered: July 2009
Member
We print some of our ViewParts using the same basic idea: render the
ViewPart as something suitable for printing in a pop-up Browser and let
the user print to the printer they want.

We render to a PDF and stream it out to a new Browser. Things to watch
out for:

a) Pop-up blockers are a pain - at the very least expect this to cause
some confusion with users, especially in IE, which refreshes the page once
pop-ups are allowed from your site and hence for RAP ends your session.
We're using RAP 1.1M3 currently which doesn't support opening a browser
using the INTERNAL or EDITOR hints.

b) Choose whether you want the browser id's to be always unique or the
same. If they're the same, only one such browser window will be open at
any one time. We use unique (randomly generated) id's to ensure a new
window will always be opened.

Hope this gives you some confidence you're on the right track.

Paul
Re: Printing (to printer) a ViewPart [message #110394 is a reply to message #110347] Thu, 23 October 2008 18:08 Go to previous message
Eclipse UserFriend
Originally posted by: spanprevention-nursubscriptions.gmail.com

Hi Paul,

Thanks a lot for your reply. I must admit, i get the impression that there
is a lot of work to be done using this approach. Basically reformat the
entire view and multiply this effort for each view.

Thanks as well for spotlighting the lurking stumbling blocks that i can
expect. I will definitely revert when i take up this functionality in
earnest seriousness.

Thanks and Regards,
-abhi
Previous Topic:server-client communication how-to
Next Topic:Interactive WEBINAR Tomorrow on RAP?
Goto Forum:
  


Current Time: Sat Jul 27 10:15:23 GMT 2024

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

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

Back to the top