Printing- multiple sections and no comments

Hi,
This problem has occured only since upgrading to Lion.
I have been trying to print a document from Word 2011, with reviewer's comments included.
When I send directly to the USB connected printer, reviewer's comments are not printed and the document is printed in multiple jobs.
When I print as PDF, reviewer's comments are included, but the document is broken into multiple pdf files.
Am using a HP LaserJet P2055d. Have tried deleting and re-adding the printer in system preferences. Have also tried reseting the print settings in systems preferences. Both with no effect.
Any suggestions greatly appreciated
Peter

Peter MacPherson wrote:
Hi,
This problem has occured only since upgrading to Lion.
I have been trying to print a document from Word 2011, with reviewer's comments included.
When I send directly to the USB connected printer, reviewer's comments are not printed and the document is printed in multiple jobs.
When I print as PDF, reviewer's comments are included, but the document is broken into multiple pdf files.
I am not sure why the reviewer's comments aren't printed. Maybe a Word upgrade will help?
As to the multiple pdf files, are there page breaks or orientation shifts (portrait to landscape or vice versa)? If so, you could try printing the doc from Acrobat.
Hope this helps.

Similar Messages

  • Print multiple sections in report

    How do I print multiple sections in a report?
    For example, if I have 5 select statements in my data section and want to print them seperately, one after the other, how would I do that?
    I do not want to merge the data together. I want it to be like 5 reports concatenated together.
    Query1 Title
    Query1Results
    Query2 Title
    Query2Results
    ... etc ...

    What you need to do is create a new main frame for each query. The easy way that use to do this is create the section of the report and let the wizard create the frames for me. Then I move them around to make the section look the way I want it to. Then I open a new report. This one I'll build it using the second query. Then again use the wizard to setup the frames. Then you'll select the main frame from the second report using the frame selet button copy it and paste the layout into the first report. You will want to paste it under the first section. A little trick here is to first draw a small line right above where you want the second section. The paste the second section. This will make sure the the second section is close to where you want it. If you do not do this Reports will put it on top of the first section a lot of times. You'll have to recreate the data model again, but that is easier then setting up all the framing on a complex layout. Then repete the second report step until you have done all the queries or sections you want.
    I hope that helps,
    Tom

  • How do I print multiple PDFs AND fit them to my paper size?

    Hi,
    I'm using a 24 inch wide plotter with roll paper. I want to be able to print multiple PDFs  AND fit them to a specified paper size. I can print one page and fit it to the paper, but I can't do it with multiple PDFs.
    For example, I have two PDFs that are only 8x8 inches. I want to print them side by side on a 24 inch x 12 inch page size and fit them to size and then FIT them to the page size so the end result will be 2 PDFs printing at 12 x 12 side by side.
    I can't seem to be able to do this. I'm sure I was able to do this using earlier versions. As it is, I have to print one at a time and waste half of my roll paper size.
    Any help?
    Adobe Acrobat Pro, Windows 7 Proffesional, HP Designjet 111 roll fed plotter.
    Thanks

    Note this illustration is Based on Mac version of HP Print Driver standard inkjet. However Control should be smilar Layouts and titles may be different:
    Adjust items shown according to pages desired

  • Need to print multiple sections in a group

    We have print customer invoices. Along with each invoice, we have to send
    1.     A Cover Letter that is always one page
    2.     Terms and conditions. This could be between 1 to 3 pages
    Our requirement is to have separate page numbering for each of these sections and each of these should start on a new page. For example if invoice is 5 pages long and Terms & conditions are 3 pages long then
    1.     Invoice pages should show Page 1 of 5, page 2 of 5, page 3 of 5, Pages 4 of 5 and Page 5 of 5
    2.     Cover letter should show page 1 of 1
    3.     Terms and condition page should show Page 1 of 3, page 2 of 3 and Page 3 of three.
    By using<?split-by-page-break?> of puttng hard section break in RTF template does not help.
    BI Publisher version is 10.1.3.4.1.
    I am very new to BI publisher and you help is highly appreciated.

    Hi,
    To send the output of multiple forms called in the same program to same spool follow the instructions
    A new spool request is appended to an existing spool request by default only in the following
    cases:
    1. The attributes such as name, output device, number of copies and formatting type(page format) agree.
        The above attributes u can check in the spool dialog box window.
    2. The existing spool request is not completed yet.
    3. Field TDNEWID  in  OUTPUT_PARAMETERS  is not set to "X".
    if any one of these conditions  is not met,  spool control automatically generates a new spool request.
    in order to appended  new spool request  to  an existing spool request set the following parameters
    in the   CONTROL_PARAMETERS
                                                          NO_OPEN                      NO_CLOSE
    1.first form output                                  blank                                  "X"
    2.additional output                                  "X"                                     "X"
             .                                                   "X"                                     "X"
    Last output                                             "X"                                     blank

  • Error printing multiple pages and incomplete pages if minimise document

    I have had this issue before but can't remember how I resolved it.  When I print from my Lenovo desktop the printer fails to print multiple pages at a time and also if I close or minimise a document I am printing then the printer will stop mid page.

    Hello @Lindseyjc81 , and welcome to the HP Forums, I hope you enjoy your experience!
    I see you're having issues printing multiple pages.  I would like to help!
    Do you have any issues making a copy?
    I'd recommend starting with a power reset.  Disconnect the power cord from the printer and the power outlet, then wait 60 seconds. After 60 seconds, plug the printer back in. Ensure you plug the printer directly to a wall outlet. Make sure to bypass any sort of surge protector or power bar.
    I would also recommend downloading and running the HP Print and Scan Doctor.
    Good luck and please let me know the results of your troubleshooting steps. Thank you for posting on the HP Forums!
    Please click “Accept as Solution " if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks" for helping!
    Jamieson
    I work on behalf of HP
    "Remember, I'm pulling for you, we're all in this together!" - Red Green.

  • Printing Multiple Photos

    Can somebody please tell me why Apple decided to change something that worked perfectly fine before? That's so.... microsoftish....
    I've finally figured out how to print multiple photos on the same sheet.. NOT intuitive at all, especially since I've seen all the posts asking how to. But the photo is blown up and zoomed in to the center of the photo and cropping everything else out. When I select a photo, it borders the entire page. I've zoomed it all the way down, as the instructions indicated without resolving my problem. Can somebody please point me in the right direction?
    Thanks

    Can somebody please tell me why Apple decided to change something that worked perfectly fine before? That's so.... microsoftish....
    No one here can - that would be a question for Apple, not for the users here
    I've finally figured out how to print multiple photos on the same sheet.. NOT intuitive at all, especially since I've seen all the posts asking how to.
    Ok - you don't like the new way to print multiple photos - again Apple is the one to tell, not us users
    But the photo is blown up and zoomed in to the center of the photo and cropping everything else out.
    I have no idea what you are saying here - you are printing multiple photos and it works fine but you don't like it but "the photo" - which one of the multiple photos? - blows up and covers the rest of the photos?
    But the photo is blown up and zoomed in to the center of the photo and cropping everything else out. When I select a photo, it borders the entire page.
    Again I have no idea what you are trying to say
    Can you please explain what you want to do and what is not working - without the unnecessary and useless editorial comments?
    LN

  • How can I print multiple images on one sheet:  PSE 10/Mac?

    When printing, I can have all of my images in the dialoug box - but cannot figure out how to get more than one image on a sheet!  For example, I am printing several photos a 2x2, and want to put as many as possilble on 1 sheet instead of using a seperate sheet for each image.  I am on a Mac.
    Any ideas??  I can't seem to find the answer.  Thanks!

    Barbara B.
    Thanks for the reply to wdwpartners question. 
    I am new to PSE 10 (on Windows 7) and having the same problem with printing multiple photos on one sheet.  With 14-20  images both contact sheet and picture package force you into 2x2 prints, not the image's original HxW ratio thus loosing some of the image on paper.  Am I missing something?
    My old version of PSE gave me an option to "print multiple photos" and custom select the image dimentions which was very useful to me.  Please let the powers that be know this user asked for that option back!!
    Thanks for a reply.

  • Cp1215 doesn't print multiple copies

    After a Windows update on my Window 7 64-bit Home Premium desktop, I am unable to print more than one copy of any document at a time from any software or web app using my cp1215.  I use the printer to print for my classroom (eg 20+ copies of one doc at a time), so I really need this.
    The problem began in March, and will resolve if I roll back the Windows update. There are about 50 individual update items, so I have no clue how to isolate this. I have tried uninstalling the printer before using Windows update and doing a complete reinstall with the latest drivers (4/13) with no luck.
    Any idea how to solve this? I don't want to go too long without keeping up with Windows security updates. Thanks!
    This question was solved.
    View Solution.

    OK, I updated in groups of five to see if I could isolate which updates might have messed up the printer. It appears be two of the "Update for Microsoft .NET Framework 4 on XP, Server 2003, Vista, Windows 7, Server 2008, Server 2008 R2 for X64." (KB2600217, KB2656351)
    So, the bulk of the Windows Updates are completed and I can still print multiple copies. At this point, though, neither of the updates above will install (they say they install, but they appear again in the update list after a reboot), so I can't be sure. I'm pretty sure they installed each time I did a bulk install.
    Right now, I can print multiple copies and I am only missing two updates. Just to be complete, I ran the HP Print & Scan Doctor, and it reports that everything is fine with the printer.  

  • Print multiple forms between FP_JOB_OPEN and FP_JOB_CLOSE

    I am aware, that there are questions regarding "Printing Multiple forms", but I didn't find answers there.
    Still my system is not working as expected:
    1.  FP_JOB_OPEN is called
    2. the generated Adobe Forms function is called multiple times
    3.  FP_JOB_CLOSE is called
    This program doesn't deliver all the pages, but just the first call. How shall I solve this problem?
    (Coding should work anywhere with copy-pase.)
    data: fm_name           type rs38l_fnam,
          fp_docparams      type sfpdocparams,
          fp_outputparams   type sfpoutputparams.
    parameters: p_fpname type fpname default 'FP_TEST_02'.
    * Get the name of the generated function module
    call function 'FP_FUNCTION_MODULE_NAME'
      exporting
        i_name     = p_fpname
      importing
        e_funcname = fm_name.
    * Sets the output parameters and opens the spool job
    call function 'FP_JOB_OPEN'
      changing
        ie_outputparams = fp_outputparams
      exceptions
        cancel          = 1
        usage_error     = 2
        system_error    = 3
        internal_error  = 4
        others          = 5.
    * Call the generated function module
    call function fm_name.
    * SECOND CALL ****************************
    call function fm_name.
    * Close the spool job
    call function 'FP_JOB_CLOSE'
    *    IMPORTING
    *     E_RESULT             =
      exceptions
        usage_error           = 1
        system_error          = 2
        internal_error        = 3
        others               = 4.

    Hi ZSOLT,
    In order to call the form multiple times please do the following,
    1) Just before your FP_JOB_OPEN you need to pass the output parameters (good practice). You can also set other parameters as well (for example nodialog, preview, copies., etc)
      CLEAR  fp_outputparams.
      fp_outputparams-dest = 'PDF1'.      "Default pdf printer
      fp_outputparams-reqnew = 'X'.       "New spool request
    Now call your FM FP_JOB_OPEN with the above output parameters.
    2) Usually this step is processed in a loop. (getting your interface data into a internal table and then looping at it)
    But here I am enhancing your example code.
    In order to trigger the form multiple times you need to change some input data to the form (for example I have changed date and time below in the prepare test data sections) so that the call function fm_name gets regenerated every time there is new data
    data  l_datatypes       type sfpdatatypes.
    prepare test data
      l_datatypes-char = '#'.
      l_datatypes-string = 'Auf geht''s! '.    "#EC NOTEXT
      l_datatypes-numc = '42'.
      l_datatypes-dec = 0 - ( 12345 / 7 ).
      l_datatypes-fltp = 0 - ( 12345 / 7 ).
      l_datatypes-int = 4711.
      l_datatypes-curr = 0 - ( 12345 / 7 ).
      l_datatypes-cuky = 'JPY'.       " no decimals
      l_datatypes-quan = 12345 / 7.
      l_datatypes-unit = 'DEG'.       " 1 decimal
      l_datatypes-date = '20040613'.      
      l_datatypes-time = '100600'.         
      l_datatypes-lang = sy-langu.
    FIRST CALL ****************************
    Call the generated function module
      CLEAR fp_docparams.
      fp_docparams-langu = 'EN'.       
      fp_docparams-country = 'US'.  
      call function fm_name
        exporting
          /1bcdwb/docparams        = fp_docparams
          datatypes                = l_datatypes
          mychar                   = l_datatypes-char
         mybyte                   =
          mystring                 = l_datatypes-string
         myxstring                =
          mydate                   = l_datatypes-date
          mytime                   = l_datatypes-time
          mynum                    = l_datatypes-numc
          myint                    = l_datatypes-int
          myfloat                  = l_datatypes-fltp
          mypacked                 = l_datatypes-dec
      IMPORTING
        /1BCDWB/FORMOUTPUT       =
    prepare test data
      l_datatypes-char = '#'.
      l_datatypes-string = 'Auf geht''s! '.    "#EC NOTEXT
      l_datatypes-numc = '42'.
      l_datatypes-dec = 0 - ( 12345 / 7 ).
      l_datatypes-fltp = 0 - ( 12345 / 7 ).
      l_datatypes-int = 4711.
      l_datatypes-curr = 0 - ( 12345 / 7 ).
      l_datatypes-cuky = 'JPY'.       " no decimals
      l_datatypes-quan = 12345 / 7.
      l_datatypes-unit = 'DEG'.       " 1 decimal
      l_datatypes-date = '20100913'.                 "You need to change your data in order it to trigger a new form with the new data.
      l_datatypes-time = '10700'.                        "You need to change your data in order it to trigger a new form with the new data.       
      l_datatypes-lang = sy-langu.
    SECOND CALL ****************************
    Call the generated function module
      CLEAR fp_docparams.
      fp_docparams-langu = 'EN'.
      fp_docparams-country = 'US'.
      call function fm_name
        exporting
          /1bcdwb/docparams        = fp_docparams
          datatypes                = l_datatypes
          mychar                   = l_datatypes-char
         mybyte                   =
          mystring                 = l_datatypes-string
         myxstring                =
          mydate                   = l_datatypes-date
          mytime                   = l_datatypes-time
          mynum                    = l_datatypes-numc
          myint                    = l_datatypes-int
          myfloat                  = l_datatypes-fltp
          mypacked                 = l_datatypes-dec
      IMPORTING
        /1BCDWB/FORMOUTPUT       =
    Close the spool job
    call function 'FP_JOB_CLOSE'
       IMPORTING
        E_RESULT             =
      exceptions
        usage_error           = 1
        system_error          = 2
        internal_error        = 3
        others               = 4.
    I have tested the above code and I am getting multiple forms.
    Please try on your end and let me know if it works.
    Thanks
    Raj

  • Print Multiple copies of report, and resetting Page number for each copy.

    Dear frnds!
    i am using developer 6i reports i have a problem.
    i want to Print Multiple copies of report, and resetting Page number for each copy" that is 4 copies of an invoice is required
    1 - for user copy
    2- gate copy
    3- accounts office
    4- office copy
    any body please tell me the solution "i am using oracle 9i and developer 6i"
    Thanx
    Ibrar

    Hi,
    I was wondering if you were able to get your multiple copies working? Below is what I have so far, just trying to get it to work before changing the actual template.
    <?for-each-group@section:R5542520/Pick_Slips_Detail_Lines_S3;PickSlipNumber_ID260?>
    <?variable@incontext:G1;R5542520/Pick_Slips_Detail_Lines_S3;PickSlipNumber_ID260?>
    <?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,3,1)?>
    HEADER
    PSN: <?$G1/Pick_Slip_Number_Display_ID54?>
    PSN Detail: <?$G1/PickSlipNumber_ID260?>
    Page 1 of 3
    <?start:body?>
    BODY
    <?$G1/LineNumber_ID6?>
    <?end body?>
    FOOTER
    <?end for-each?>
    <?end for-each-group?>
    XML:
    <R5542520>
    <Pick_Slips_Detail_Lines_S24>
    <Header_Custom_Section_S24>
    <Pick_Slip_Number_Display_ID54>123456</Pick_Slip_Number_Display_ID54>
    <PickSlipNumber_ID260>123456</PickSlipNumber_ID260>

  • Script that worked in CS does not work in CS4 - multiple open page, print , pdf export and close

    I had a script that worked great for me in Indesign CS. But now does not work in CS4. Anyone knows what needs to be done to make it work again ?
    When I drop folder with indesign files on top of this script:
    1. opens first page
    2. turns specific layer on
    3. prints using preset
    4. exports using preset
    5. close without saving
    6. next page
    Anyone who can give me solution or idea how this should work is greatly appreciated.
    on open sourceFolders
    repeat with sourceFolder in sourceFolders
    tell application "Finder"
    try
    -- If you would like to include subfolders, you say - every file of entire contents of folder…
    set idFiles to (every file of folder sourceFolder whose file type is "IDd5") as alias list
    on error -- work around bug if there is only one file
    set idFiles to (every file of folder sourceFolder whose file type is "IDd5") as alias as list
    end try
    end tell
    if idFiles is not {} then
    tell application "Adobe InDesign CS4"
    set user interaction level to never interact
    repeat with i from 1 to count of idFiles
    open item i of idFiles
    tell document 1
    try
    set visible of layer "ImagesTag_Layer" to true
    end try
    set myPreset to "letter size" -- name of print style to use
    with timeout of 700 seconds
    print using myPreset without print dialog
    end timeout
    set myPreset1 to "pdf preset name" -- name of pdf export style to use
    set myName to the name -- name includes .indd should remove at some point          
    with timeout of 700 seconds
    export format PDF type to "users:temp:Desktop:pdf:" & myName & ".pdf" using myPreset1 without showing options -- set path here format ComputerName:Folder1:Folder2:......:FileName.pdf
    end timeout
    close without saving
    end tell
    end repeat
    set user interaction level to interact with all
    end tell
    end if
    return 10 -- try again in 10 seconds
    end repeat
    end open

    (Disclaimer: me not an AS guy!)
    First thing I noticed is the interaction level is set off. If you comment out this line
    set user interaction level to never interact
    you might be able to pinpoint the exact error -- ID will display a standard "failed" dialog, hopefully showing the line that it fails on.
    A quick question: the script assumes two presets in your InDesign: one for print ("letter size") and one for PDFs ("pdf preset name"):
    set myPreset to "letter size" -- name of print style to use
    set myPreset1 to "pdf preset name" -- name of pdf export style to use 
    Do these actually exist in your CS4, with the same (non)capitalization and spaces?

  • Open and print multiple files from the Finder all at once.

    I'm trying to research how to do this. In OS9 you used to be able to hi-lite multiple files (Word files for example) and just hit Command+P. This would automatically open all of the files AND print them.
    I can't seem to do this in my OS X. Or can I? I can hi-lite and go to File/Print, but the computer is only opening but not printing.
    Any suggestions??
    iMac   Mac OS X (10.4.8)  

    I don't know how to both "open and print" multiple files in one step. The ⌘O combination of course will open multiple items. The items remain selected so switching back to the "Finder" and dragging multiple icons onto the icon for "/Applications" > "Utilities" > "Printer Setup Utility.app" seems to cause them all to be printed to the default printer.
    Alternatively, a user's "~/Library/Printers" folder contains printer icons -- I'm not sure what they are exactly, but they represent the printers set up for that account. They function pretty much like the pre-OS X "Desktop Printer" icons so dragging and dropping multiple files onto them should cause them to be printed. It may even be possible to create aliases to them on the "Desktop" to recreate "Desktop Printer" functionality. But again, this won't open the files into their applications.

  • I need to host a Shared PDF on SharePoint. If it is on SharePoint can only one person comment at a time? I know documents have to be checked out when using SharePoint. I need multiple users to be able to comment in real time and see comments in real time.

    I need to host a Shared PDF on SharePoint 2010. If it is on SharePoint can only one person comment at a time? I know documents have to be checked out when using SharePoint. I need multiple users to be able to comment in real time and see comments in real time. Is this possible?

    try here:
    http://www.bbb.org
    File a complaint with them. Verizon will call you to fix the blunder.
    But remember it is always up to the customer to insure what they are getting and what it costs. Don't trust the word of a sales person who makes their living on getting that sale. Lies, deceit or false promises will be and have been used by sales people for thousands of years.
    Good Luck

  • How can I print multiple copies of the same photo onto one sheet of paper?  Do I have to Duplicate the photo in iPhoto and then select them all?

    How can I print multiple copies of the same photo onto one sheet of paper?  Do I have to Duplicate the photo in iPhoto and then select them all?

    no - you simply have to select the option to print mucliples of a photo on a page
    select the photo and go to the file menu ==> print - select the printer, paper size and print size and click customize - in the tool bar click on the settings icon (the gear looking thingy) and select "multiple of the same photo per page" and the preview will reflect this option showing a full page of the selected size photos
    LN

  • Print JTable with Multiple pages and rows

    I took the printing example at http://java.sun.com/developer/onlineTraining/Programming/JDCBook/advprint.html#pe and modified it a bit to include the following:
    1) To Print Multiple pages
    2) To wrap lines that is too long for the column
    3) To print with a more proffesional style, so that it doesn't look like a screen capture is printed
    4) To align the numbers to the right and center column headings
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.Dimension;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    public class Report implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame frame;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public Report()
              frame = new JFrame("Sales Report");
              frame.addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
              final String[] headers =
                   "ID",
                   "Description",
                   "open price",
                   "latest price",
                   "End Date",
                   "Quantity"
              int count = 0;
              final Object[][] data =
                   {new Integer(count++), "Box of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of Biros ppppppppppppppp", "1.00", "4.99", new Date(), new Integer(200000)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
                   {new Integer(count++),  "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
                   {new Integer(count++),  "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "tape", "1.00", "1.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "stapler", "4.00", "4.49", new Date(), new Integer(1)},
                   {new Integer(count++),  "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)}
              TableModel dataModel = new AbstractTableModel()
                   public int getColumnCount() { return headers.length; }
                   public int getRowCount() { return data.length;}
                   public Object getValueAt(int row, int col)
                        return data[row][col];
                   public String getColumnName(int column)
                        return headers[column];
                   public Class getColumnClass(int col)
                        return getValueAt(0,col).getClass();
                   public boolean isCellEditable(int row, int col)
                        return (col==1);
                   public void setValueAt(Object aValue, int row, int column)
                        data[row][column] = aValue;
              tableView = new JTable(dataModel);
              JScrollPane scrollpane = new JScrollPane(tableView);
              scrollpane.setPreferredSize(new Dimension(500, 80));
              frame.getContentPane().setLayout(new BorderLayout());
              frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
              frame.pack();
              JButton printButton= new JButton();
              printButton.setText("print me!");
              frame.getContentPane().add(BorderLayout.SOUTH,printButton);
              // for faster printing turn double buffering off
              RepaintManager.currentManager(frame).setDoubleBufferingEnabled(false);
              printButton.addActionListener( new ActionListener()
                   public void actionPerformed(ActionEvent evt)
                        doPrint();
              frame.setVisible(true);
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 10);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(frame, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = printLine(g2, pageFormat, fontMetrics, -1, (int)pageFormat.getImageableY() + fontHeight, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
          * We can't guarantee that the same amount of rows will be displayed on each page,
          * the row heights are dynamic and may wrap onto 2 or more lines.
          * Thus we need to calculate the height of each row and then test how may rows
          * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight = g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = tableView.getValueAt(i, j).toString();
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
          * Print the headers or a row from the table to the graphics context
          * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = obj.toString();
                   else
                        align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent(),
                             pageFormat.getImageableY() + pageFormat.getImageableWidth(),
                             next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent()));
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public static void main(String[] args)
              new Report();
    }

    Fixed some bugs and added a title. Just pass in a JTable and the class will do the rest.
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.print.*;
    import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
    import java.text.*;
    import java.math.*;
    public class PrintJTable implements Printable
         private final int LEFT_ALIGN = -1;
         private final int CENTER_ALIGN = 0;
         private final int RIGHT_ALIGN = 1;
         private JFrame m_parent;
         private String m_title;
         private JTable tableView;
         private String lastPrintDate;
         private Font defaultFont;
         private Font headerFont;
         private Font footerFont;
         private int headerHeight;
         private int footerHeight;
         private int cellBuffer = 5;
         private boolean first_pass;
         private ArrayList pages;
         public PrintJTable(JFrame parent, JTable table)
              m_parent = parent;
              tableView = table;
              doPrint();
         public PrintJTable(JFrame parent, String title, JTable table)
              m_parent = parent;
              m_title = title;
              tableView = table;
              doPrint();
          * Reset variables before printing
         private void prepareForPrint()
              pages = new ArrayList();
              first_pass = true;
          * Display a print dialog with some hardcoded defaults
          * The print fonts are also hardcoded
         public void doPrint()
              try
                   String jobName = "Java Report";
                   defaultFont = new Font("Arial", Font.PLAIN, 8);
                   footerFont = new Font("Arial", Font.PLAIN, 6);
                   headerFont = new Font("Arial", Font.BOLD, 8);
                   PrinterJob prnJob = PrinterJob.getPrinterJob();
                   prnJob.setPrintable(this);
                   PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
                   prnSet.add(new Copies(1));
                   prnSet.add(new JobName(jobName, null));
                   prnSet.add(MediaSizeName.ISO_A4);
                   PageFormat pf = prnJob.defaultPage();
                   pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
                   prnJob.setJobName(jobName);
                   PrintService[] services = PrinterJob.lookupPrintServices();
                   if (services.length > 0)
                        if (prnJob.printDialog(prnSet))
                              * Get print date
                             String dateFormat = "dd/MM/yyyy HH:mm:ss";
                             DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
                             lastPrintDate = m_DateFormat.format(new Date()).toString();
                             prepareForPrint();
                             prnJob.print(prnSet);
                   else
                        JOptionPane.showMessageDialog(m_parent, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
                        return;
              catch (PrinterException e)
                   e.printStackTrace();
         public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
               * Check if this is the first time the print method is called for this print action.
               * It is not guaranteed that the print will be called with synchronous pageIndex'es,
               * so we need to calculate the number of pages and which rows appear on which pages.
               * Then the correct page will be printed regardless of which pageIndex is sent through.
              if (first_pass)
                   calcPages(g, pageFormat);
              first_pass = false;
              // Stop printing if the pageIndex is out of range
              if (pageIndex >= pages.size())
                   return NO_SUCH_PAGE;
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              double test = 0;
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
                   test += columnWidths;
              // Reset the view to the start of the page
              g2.translate(0, 0);
              // Draw a rectangle to see the printable area
              g2.draw3DRect((int)pageFormat.getImageableX(),
                        (int)pageFormat.getImageableY(),
                        (int)pageFormat.getImageableWidth(),
                        (int)pageFormat.getImageableHeight(),
                        false);
              // Calculate the header height
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              // Print the headers and retreive the starting position for the data
              int next_row = (int)pageFormat.getImageableY() + fontMetrics.getHeight();
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   g2.drawString(m_title,
                                       (int)(pageFormat.getImageableX()),
                                       next_row);
                   Color current_color = g2.getColor();
                   g2.setColor(Color.lightGray);
                   int y = next_row + fontMetrics.getDescent();
                   g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                                  y,
                                  (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                                  y));
                   g2.setColor(current_color);
                   next_row += fontMetrics.getHeight();
              next_row = printLine(g2, pageFormat, fontMetrics, -1, next_row, columnWidths);
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              // Start printing the detail
              ArrayList page = (ArrayList)pages.get(pageIndex);
              int start = ((Integer)page.get(0)).intValue();
              int end = ((Integer)page.get(1)).intValue();
              for (int i = start; i <= end; i++)
                   next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
              // Print the footer
              g2.setFont(footerFont);
              String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
              g2.drawString(pageFooter,
                             (int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
                             (int)(pageHeight - fontDescent));
              return PAGE_EXISTS;
         * We can't guarantee that the same amount of rows will be displayed on each page,
         * the row heights are dynamic and may wrap onto 2 or more lines.
         * Thus we need to calculate the height of each row and then test how may rows
         * fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
         public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
              Graphics2D     g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              // The footer will be one line at the bottom of the page, cater for this.
              g2.setFont(footerFont);
              footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
              g2.setFont(defaultFont);
              FontMetrics fontMetrics = g2.getFontMetrics();
              int fontHeight = fontMetrics.getHeight();
              int fontDescent = fontMetrics.getDescent();
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
              // Shrink or expand the table to fit the page width
              double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
              // Calculate the width in pixels for each column
              double[] columnWidths = new double[tableView.getColumnCount()];
              for(int i = 0; i < tableView.getColumnCount(); i++)
                   columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
              // Calculate the header height
              int maxHeight = 0;
              g2.setFont(headerFont);
              fontMetrics = g2.getFontMetrics();
              headerHeight = 0;
              if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
                   headerHeight = fontMetrics.getHeight();
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = tableView.getColumnName(j).toString();
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
              headerHeight += g2.getFontMetrics().getHeight() * maxHeight;
              g2.setFont(defaultFont);
              fontMetrics = g2.getFontMetrics();
              int pageNum = 0;
              int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
              int prev_row = 0;
              int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
              int i = 0;
              ArrayList page = new ArrayList();
              page.add(new Integer(0));
              for (i = 0; i < tableView.getRowCount(); i++)
                   maxHeight = 0;
                   for (int j = 0; j < tableView.getColumnCount(); j++)
                        String value = formatObject(tableView.getValueAt(i, j));
                        int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                        if (numLines > maxHeight)
                             maxHeight = numLines;
                   prev_row = next_row;
                   next_row += (fontHeight * maxHeight);
                   // If we've reached the bottom of the page then set the current page's end row
                   if (next_row > bottom_of_page)
                        page.add(new Integer(i - 1));
                        pages.add(page);
                        page = new ArrayList();
                        page.add(new Integer(i));
                        pageNum++;
                        next_row = (int)pageFormat.getImageableY()
                                       + fontHeight
                                       + ((int)pageFormat.getHeight() * pageNum)
                                       + headerHeight;
                        bottom_of_page = (int)(pageFormat.getImageableHeight()
                                            + pageFormat.getImageableY())
                                            + ((int)pageFormat.getHeight() * pageNum)
                                            - footerHeight;
                        //Include the current row on the next page, because there is no space on this page
                        i--;
              page.add(new Integer(i - 1));
              pages.add(page);
         * Print the headers or a row from the table to the graphics context
         * Return the position of the row following this one
         public int printLine(Graphics2D g2,
                                       PageFormat pageFormat,
                                       FontMetrics fontMetrics,
                                       int rowNum,
                                       int next_row,
                                       double[] columnWidths)
                   throws PrinterException
              int lead = 0;
              int maxHeight = 0;
              for (int j = 0; j < tableView.getColumnCount(); j++)
                   String value = null;
                   int align = LEFT_ALIGN;
                   if (rowNum > -1)
                        Object obj = tableView.getValueAt(rowNum, j);
                        if (obj instanceof Number)
                             align = RIGHT_ALIGN;
                        value = formatObject(obj);
                   else
                        //align = CENTER_ALIGN;
                        value = tableView.getColumnName(j);
                   int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
                   if (numLines > maxHeight)
                        maxHeight = numLines;
                   if (fontMetrics.stringWidth(value) < columnWidths[j])
                        // Single line
                        int offset = 0;
                        // Work out the offset from the start of the column to display alignment correctly
                        switch (align)
                             case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
                             case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
                             default: offset = 0; break;
                        g2.drawString(value,
                                       lead + (int)(pageFormat.getImageableX() + offset),
                                       next_row);
                   else
                        for(int a = 0; a < numLines; a++)
                             //Multi-Line
                             int x = 0;
                             int width = 0;
                             for(x = 0; x < value.length(); x++)
                                  width += fontMetrics.charWidth(value.charAt(x));
                                  if (width > columnWidths[j])
                                       break;
                             int offset = 0;
                             // Work out the offset from the start of the column to display alignment correctly
                             switch (align)
                                  case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))); break;
                                  case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))) / 2; break;
                                  default: offset = 0; break;
                             g2.drawString(value.substring(0, x),
                                            lead + (int)(pageFormat.getImageableX() + offset),
                                            next_row + (fontMetrics.getHeight() * a));                    
                             value = value.substring(x);
                   lead += columnWidths[j] + cellBuffer;
              // Draw a solid line below the row
              Color current_color = g2.getColor();
              g2.setColor(Color.lightGray);
              int y = next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent();
              g2.draw(new Line2D.Double(pageFormat.getImageableX(),
                             y,
                             (pageFormat.getImageableY() + pageFormat.getImageableWidth()),
                             y));
              g2.setColor(current_color);
              // Return the position of the row following this one
              return next_row + (fontMetrics.getHeight() * maxHeight);
         public String formatObject(Object obj)
              String value = (obj == null) ? "" : obj.toString();
              return value;

Maybe you are looking for

  • Mac will not boot up

    My mac will not boot up - shows a sort of stop sign then grey screen

  • CK71 suddenly hang when taking a picture using the camera

    Hi team, The customer is using the CK71 with camera option. OS is. 1.61.22.72. Our partner developed the camera application based on Intermec source file according to the IDL(Multimedia Resource Kit). Regarding the source that the partner tested, I a

  • Sony Marine Audio trouble

    Hello, i have a Time clock problem with my CDX-GT650UI,everytime i power on/off the car the time(clock) reset itself , i checked the fuse behind and its ok.What can be the problem?

  • Battery status + Speedstep Centrino

    I recently bought an Acer TravelMate 4501LCi and I am really happy with it, except that it seems not to be able to determine the current battery strength. I have acpi and acpid installed. I also have acpi listed in the modules array and acpid in my d

  • How to compare two VBAI file?

    How do I compare two VBAI files? I have 2 parallel version of a VBAI file. How can I compare their differences?