Using PrinterJob to print a Component only uses 2/3 of the page

Okay, I'm now trying to get printing working with my app.
I have a JFrame that contains several custom components.
I invoke the print like this:
               PrinterJob job = PrinterJob.getPrinterJob();
               job.setPrintable(GraphWindow.this);
               if (job.printDialog()) {
                    try {
                         job.print();
                    } catch (PrinterException pe) {
                         logger.error("actionPerformed: Print Error: ", pe);
               }The Printable interface is implemented like this:
          if (pageIndex > 0) {
               return (NO_SUCH_PAGE);
          } else {
               Graphics2D g2d = (Graphics2D) graphics;
               logger.debug("print: clip=" + g2d.getClipBounds() + ", devbounds=" + g2d.getDeviceConfiguration().getBounds());
               g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
               RepaintManager currentManager = RepaintManager.currentManager(this);
               currentManager.setDoubleBufferingEnabled(false);
               paint(g2d);
               currentManager.setDoubleBufferingEnabled(true);
               return (PAGE_EXISTS);
          }When the printout comes out, it covers about 2/3 the page in each dimension. It could easily be larger and still fit.
The print log message looks like this:
print: clip=java.awt.Rectangle[x=15,y=15,width=582,height=762], devbounds=java.awt.Rectangle[x=0,y=0,width=5100,height=6600]
When the paint() method is called, the window is still it's normal screen resolution - so my code paints in that res. This results in some chunky output on the printer.
So, the final questions are:
1) Why is the Clip (and probably the transform) setup for something that is noticeably larger than the Frame being printed? I'd like to force it to "Fit to Page". I'm guessing it's doing some magic DPI calculations, but I don't see how I can change those.
2) Is there any way I can increase the print resolution? Somehow I doubt I can set my Frame size to be 5000x6000 and have it work properly.

I don't know about java... but the trick in VB was to create an invisible form in the background, and print that via Form.PrintForm()... but VB allowed you to create a form any size you liked... even if it was 100 times the current screen size.
Interesting little problem...
PS: I'd only resort to an invisible Frame in the absence of a better solution... ie: pray for a response from someone who actually knows what they're talking about ;-)

Similar Messages

  • Using iphone to print to hp 8500a plus, but cannot get the picture centered on the photo paper

    using iphone to print to hp 8500a plus, but cannot get the picture centered on the photo paper    installed hp photo app on iphone to utilize printer

    Are you using Page Setup within Firefox?
    https://support.mozilla.org/en-US/kb/how-print-websites#w_changing-the-page-setup
    See - Margins and Header/ Footer

  • I have 3 PC's.  Two of them I use at 2 different locations and only use them 6 months a year.  So, if I have Icloud for my calendar, and turn on a computer that has not been used for 6 months, does all the old information on that computer to go Icloud?

    I have 3 PC's.  Two of them I use at 2 different locations and only use them 6 months each year.  When I turn on a computer that has not been used for 6 months, does all of the old information from that computer end up in Icloud?  Does Icloud push all the new calendar and contact items over the old items?

    A reset may help. Tap and hold the Home button and the On/Off buttons for approximately 10-15 seconds, until the Apple logo reappears. When the logo appears, release both buttons.
    No content is affected by this procedure.

  • Why does my hard drive state I have used 500 gb when I have only used 280 gb?

    Why does my hard drive state I have used 500 gb when I have only used approximately 280 gb?

    Have you emptied your trash lately...
    Also... See these links...
    Apple ML = Increase Disc Space
    http://support.apple.com/kb/PH10677
    See Here  >  Where did my Disk Space go?
    And Here  >  The Storage Display

  • Cannot use file for clustered server. Only formatted files on which the cluster resource of the server has a dependency can be used. Either the disk resource containing the file is not present in the cluster group or the cluster resource of the Sql Serve

    Hi
    Windows serv 2012 cluster on sql 2012 cluster with 2 instance. on works fine , Second instanc ewhen i try to creat DB a get this message. 
    Cannot use file  for clustered server. Only formatted files on which the cluster resource of the server has a dependency can be used. Either the disk resource containing the file is not present in the cluster group or the cluster resource of the Sql
    Server does not have a dependency on it.
    CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (Microsoft SQL Server, Error: 5184)
    Any help please
    kam
    KAMEL

    Hi Saurabh
    Exactly I have SQL SERVER 2012
    Failover Clustering   in windows server 2012 with two nodes with
    two instances and exactly I run them in the same server and each instance with
    three drives Backup, Data and log.   
    KAMEL

  • Can I create bookmarks on PDF document using stadard acrobat writer? or only using professional acrobat writer?

    can I create bookmarks on PDF document using stadard acrobat writer? or only using professional acrobat writer?

    Hi hagitl14083762,
    Bookmarking in available in both Acrobat Pro and Standard. You'll find instructions here: Adobe Acrobat X Standard * Create a bookmark (while written for Acrobat X, these instructions apply to Acrobat XI as well).
    Please let us know if you have additional questions.
    Best,
    Sara

  • Fbl5n: The printer provides me only one customer items for each page...

    Hi all,
    launching t.code FBL5N, and printing the repost list, the printer provides me only one customer items for each page...
    I'd like obtaining more customer items for each page...
    What to do?
    Thanks

    Hi Umberto..
    Thats how the standard report works..
    To meet your requirement, you would probably need to look at another standard report.
    In case you need further clarification, please feel free to write to me..
    Good Luck!
    Lucid-Mind...

  • Printed webpage only shows about 20% of the page, centered

    Never had a problem, suddenly can't print a webpage. Instead of everything on the page, it only prints about 20% of the horizontal line, starting from left margin; the printed part is centered on the paper. Also, the amount that is printed spans five pages, when normally I could print the webpage on a single sheet. Maybe the best description is that the printed appearance looks as if the printer thinks the paper is 2.5 x 4 inches. Have checked paper size, margins, etc.

    Did a printer reset and that fixed the problem. Got so focused on checking all my settings I forgot about that universal antidote! Thanks for your prompt and helpful reply.

  • Is there any way to stop the print screen from dropping down on top of the page to be printed.  Can the print screen be moved?

    Is there a way to stop the print screen from dropping down on top of the page to be printed.  Can the print screen be moved?  When the print screen drops down, it covers the page and the info needed to create the file.  Thank you

    You will find that this is application dependent.  Most Apple applications such as Safari and Mail will use the "sheet" type of dialog boxes that you are referring.  There is no way for the user to change that behavior.  Other, non-Apple, applications like Firefox use a "modal" dialog box for printing etc.  The modal boxes can be moved around so you can see the page behind.

  • Feel a bit silly! But my mouse only seems to scroll down the page but not up??

    I Feel a bit silly! But my mouse only seems to scroll down the page but not up??

    Rosa R wrote:
    Hi All - my question can be a bit silly ...
    Not silly at all...
    See  >  Change your iTunes Store country
    Here  >  http://support.apple.com/kb/HT1311
    Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region = Change Country / Region

  • Can I save my photos from my Nikon Coolpix AWS 120 camera to my camera roll on my ipad over wifi without using any type of adapter but only using wifi?

    Can I use my ipad mini and my wifi camera to save my photos on my ipad without using an adapter and only using wifi? If so. How

    Not unless you import them to your computer first, then sync with iTunes over WiFi, but I suspect that sort of defeats the purpose.
    Just use the Lightning to USB Camera Adapter to connect your camera directly, or alternatively, the SD Card Adapter.

  • Can I set up my iPad to use my wireless printer now that I use Windows 8 Pro on my home network. I moved from Vista a short while ago. thanks

    Can someone explain how I go about setting up my iPad 2 to use a wireless printer as an airprinter - I had the thing working perfectly under Vista, however it all seems so much more reluctant under Windows 8 Pro.
    I'm in the UK, but that doesn't make me a bad person ...
    Thanks
    pavard1

    This is not really an appropriate question for this forum - it's for the specific Apple product called Apple Remote Desktop which is for managing networked Macs - but you forward the ports to the iMac's internal IP address, the one assigned to it via the Airport (setting a static IP address usually is better, though, since it won't change when you restart the Mac). This may be of help:
    http://gigaom.com/apple/how-to-port-forwarding-on-a-airport-extreme-time-capsule /
    Regards.

  • Use on e-print an email formerly used for the same printer

    How can I use the same email i used to use for a printer before reinstalling it? The eprint center tells me that the email already exist!
    Thanks in advance
    This question was solved.
    View Solution.

    At this point in time the emails will be locked for 6 months if you change the email, or delete the printer. You can however add a number to the end to make it a little easier to remember a new email.
    Jon-W
    I work on behalf of HP
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    Click the KUDOS STAR on the left to say “Thanks” for helping!

  • When I AirPrint it only does small portions of the page. How do I get it to print the whole page?

    When I AirPrint The printer only prints a portion of the page.  How do I get it to print the whole page.

    It would help if you stated what printer you are using and what application you are doing the printing from. Also, what are you printing?

  • Since upgrading to Firefox 4, when I printed anything, I got a gray background covering the page. What I printed could be seen, but it wasted a lot of ink. I had to 'downgrade' to the prior version of Firefox; if it won't be supported soon, what do I do?

    I am using Windows XP, SP3. I have experienced this printing problem with anything I print from the internet, any site. I can read whatever I am printing, but there is a light gray background on the whole page. I saw something similar in the problems already listed in the help section, but the fix in the about:config files did not help; same problem existed. The only thing that fixed it was to uninstall Firefox 4, and reinstall the prior version. I am now using version 3.6.17. I have read the warning when I start Firefox to seriously consider upgrading to version 4, and that the older version won't be supported, but since I can't print from it without wasting considerable ink, and having pages that are unattractive and difficult to use, I don't know what to do. Please help. I want to use the new version, but MUST be able to print clean pages, without a gray background on each one.

    I have had a similar problem with my system. I just recently (within a week of this post) built a brand new desktop. I installed Windows 7 64-bit Home and had a clean install, no problems. Using IE downloaded an anti-virus program, and then, because it was the latest version, downloaded and installed Firefox 4.0. As I began to search the internet for other programs to install after about maybe 10-15 minutes my computer crashes. Blank screen (yet monitor was still receiving a signal from computer) and completely frozen (couldn't even change the caps and num lock on keyboard). I thought I perhaps forgot to reboot after an update so I did a manual reboot and it started up fine.
    When ever I got on the internet (still using firefox) it would crash after anywhere between 5-15 minutes. Since I've had good experience with FF in the past I thought it must be either the drivers or a hardware problem. So in-between crashes I updated all the drivers. Still had the same problem. Took the computer to a friend who knows more about computers than I do, made sure all the drivers were updated, same problem. We thought that it might be a hardware problem (bad video card, chipset, overheating issues, etc.), but after my friend played around with my computer for a day he found that when he didn't start FF at all it worked fine, even after watching a movie, or going through a playlist on Youtube.
    At the time of this posting I'm going to try to uninstall FF 4.0 and download and install FF 3.6.16 which is currently on my laptop and works like a dream. Hopefully that will do the trick, because I love using FF and would hate to have to switch to another browser. Hopefully Mozilla will work out the kinks with FF 4 so I can continue to use it.
    I apologize for the lengthy post. Any feedback would be appreciated, but is not necessary. I will try and post back after I try FF 3.16.6.

Maybe you are looking for