Results 1 to 5 of 5
  1. #1
    aryan.838 is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Question Adding printing in Netbeans app

    I am developing an a reporting application where user has to fill some
    JField values and then finally click print....
    but i dont know what code is to be written for click action for print button so that windows print dialog opens up.:confused:

  2. #2
    Kendall is offline Member
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Default

    Simplest option is with the Desktop class.

    But this will not give you the pop-up, instead printing right to the default printer.

    What you probably want is the slightly more complex PrinterJob.

    Hope that's what you're looking for.
    -K

  3. #3
    aryan.838 is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Red face Thanxxxx..........

    if u cud get in more details becoz i m new to this printerjob class.
    I need to set page elements, size, margin, position of various strings on page.
    My app is like...
    You have to fill out fields in wizard form and then all field values are stored in strings on the last page u see summary and hit print button(Jbutton) but i need to set font, size, their positions(strings) on page.(This is one time only every time user wont be setting these).
    Hope u can me something on this.

  4. #4
    Kendall is offline Member
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by aryan.838 View Post
    if u cud get in more details becoz i m new to this printerjob class.
    I did link you to the class documentation. Start with reading the relevant passages in that. You will probably find the printDialog method useful.

    If you want complete control of what the document will look like, you will also have to make a layout with document rendering software. I would recommend iTextPDF. There are lots of examples on their website.

    After creating a PDF document with iTextPDF, it will be saved to hard drive. You can then use the printing class to send it to the printer.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by aryan.838 View Post
    if u cud get in more details becoz i m new to this printerjob class.
    All about this class you can find on the Java DOC. Do you have a copy of the DOC? If not please download it and keep with you, as the first step.

    Search on our forum. I've already answered couple of similar questions on printing last few days.

Similar Threads

  1. Adding to JList with Netbeans
    By kewlgeye in forum NetBeans
    Replies: 7
    Last Post: 03-28-2012, 08:39 PM
  2. Printing
    By zzpprk in forum AWT / Swing
    Replies: 0
    Last Post: 01-20-2010, 12:25 PM
  3. Replies: 0
    Last Post: 11-20-2009, 06:16 AM
  4. Printing Help...
    By chiragkini in forum AWT / Swing
    Replies: 1
    Last Post: 02-17-2009, 07:07 AM
  5. Adding Business Methods to an EJB in NetBeans
    By JavaForums in forum NetBeans
    Replies: 0
    Last Post: 07-31-2007, 12:13 AM

Posting Permissions

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