This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes PageFormat and PrintRequestAttributeSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "PageFormat and PrintRequestAttributeSet" Watch "PageFormat and PrintRequestAttributeSet" New topic

PageFormat and PrintRequestAttributeSet

marwen Bakkar
Ranch Hand

Joined: Jan 28, 2010
Posts: 84

What I want to achieve is the following:

Three buttons : Print Setup, Print Preview and Print.

When clicking on Print Set Up, it opens the dialog which that has all the printing settings.

Once i am done with the setup, i can opt for print OR print preview or both one after another.

Currently it is not possible to create a PrintRequestAttributeSet using a PageFormat instance. Which means that if i am going to preview an image I have to define the page layout in two different locations. One for previwing and one for printing. Or am I wrong?
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 198
please explore it more.
marwen Bakkar
Ranch Hand

Joined: Jan 28, 2010
Posts: 84
I use pageFormat = printJob.pageDialog(pageFormat) to display the page layout dialog and let the user choose his setts. The PageFormat returned is later used to display a print preview dialog. My problem is how to construct a PrintRequestAttributeSet based on this PageFormat instance so if a print operation is requested it is performed with those setts. Does that make sense?
marwen Bakkar
Ranch Hand

Joined: Jan 28, 2010
Posts: 84
Any suggestions?
I agree. Here's the link:
subject: PageFormat and PrintRequestAttributeSet
Similar Threads
Directly Open Native Print Properties
Printing in Java
how to print entire Jframe ?
printing in java