aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Printing a web page using the Printable class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Printing a web page using the Printable class" Watch "Printing a web page using the Printable class" New topic
Author

Printing a web page using the Printable class

Andres Delrotti
Ranch Hand

Joined: Aug 11, 2005
Posts: 98
Hello Friends,

I am currently creating a reporting application. One of its features include being able to print the report page in a printable format. Now, our client wanted to eliminate the annoying printer settings UI that comes out everytime we use the window.print() javascript command to print a webpage. So in order to eliminate this, we resorted to using Java's Printable Interface in which we would just enter the Report Page's URL and let it to the print job without having the print settings UI to pop up. The print button at the Report Page would now call a Servlet which would then call the class which implements the Printable interface.

Now the Problem is,

The URL of the report page that we would like to print is eg. (http://localhost:9080/MyApp/PrintReportPage.do) which is a Struts link. If we input that exact url in the class that implements Printable, we could not print the report page the way we like it since THE SESSION ALWAYS TERMINATES. The page containing the error "session was terminated" was printed instead of the Report Page.

Is there any way to solve this type of problem?
[ August 02, 2006: Message edited by: aj delr ]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Ahem, you are aware of the fact that the servlet would print on the server side, not on the client side?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Printing a web page using the Printable class
 
Similar Threads
Object Reference Conversion
Super ref = new Sub();
Retries is Java printing?
Printing an object
Capturing the current window's cotents?