Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By kneitzel

Thread: print jpanel or convert to pdf

  1. #1
    sharmapiyush is offline Member
    Join Date
    Apr 2014
    Rep Power

    Default print jpanel or convert to pdf

    can anyone tell me how to print a jpanel contents or is there any tool that can save the jpanel contents in pdf.
    i have tired using

    but that not working that gives an error as

    java code : -1074232

    something like that,


  2. #2
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Rep Power

    Default Re: print jpanel or convert to pdf


    could you give the exact code that you tried? printAll needs an argument - what did you supply there?

    If you want to print your frame, then you should:
    Get a PrinterJob through PrinterJob.getPrinterJob();
    Then you can call printerJob.setPrintable(yourForm);
    Then calls to printDialog and print should be done.

    What happens is, that print is called. This is nice so you could use that method to
    - maybe set the background temporarily
    - scale the form so it fits on the page.
    And of course: The call of printAll is done in there to print the form to the given graphics instance.

    You can find examples on the internet. So one hit is java - How to print a JPanel with swing components? - Stack Overflow

    With kind regards,

    Lepski likes this.

Similar Threads

  1. print out jpanel
    By slamdon in forum AWT / Swing
    Replies: 1
    Last Post: 03-13-2013, 09:15 PM
  2. unable to print components in JPanel
    By in forum New To Java
    Replies: 9
    Last Post: 06-04-2012, 06:47 PM
  3. I would like to print this JPanel class. How?
    By AcousticBruce in forum New To Java
    Replies: 8
    Last Post: 02-26-2011, 07:25 PM
  4. print multiple jpanel
    By anilkumar_vist in forum New To Java
    Replies: 0
    Last Post: 02-05-2010, 04:28 PM
  5. print jpanel
    By anilkumar_vist in forum New To Java
    Replies: 3
    Last Post: 01-08-2010, 01:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts