Hi Bruno,

please ignore my previous mail. I have found the reason that it's blank, though I have yet to find a way to overcome it. Basically, it seems that it will only be written into the PDF after I close the pane. (I have displayed the pane so as to check the content, making it something like a browser). I will try to figure this part out.

Meanwhile, can you point me to some part where I can learn how to print the info from JEditorpane into multiple page in the PDF? Currently whatever cannot fit the page is being cut off, and I only have 1 page in the PDF.

Thanks a lot for your help!

Dorothy



Dorothy NG/OPS/AH/NHG

15/06/2006 09:39 PM

To
bruno <[EMAIL PROTECTED]>
cc
Post all your questions about iText here <[email protected]>
Subject
Re: [iText-questions] Creating PDF using JEditorPaneLink




Hi Bruno,

I tried rebooting my PC and I can open the pdf now. However it's blank.

Did I do my codes wrongly? I attached the code again:

try{
    com.lowagie.text.Document document1 = new com.lowagie.text.Document(PageSize.A4, 80, 50, 30, 65);
    PdfWriter writer = PdfWriter.getInstance(document1, new FileOutputStream("test.pdf"));
    document1.open();
    PdfContentByte cb = writer.getDirectContent();
    cb.saveState();
    DefaultFontMapper mapper = new DefaultFontMapper();
   
    PdfGraphics2D g2 = (PdfGraphics2D)cb.createGraphics(612, 792, mapper);
   
    mainPane.paint(g2);
    g2.dispose();
    document1.close();
    writer.close();
    }catch (Exception e){
            System.err.print( e.getMessage());
    }

Thanks!

Dorothy



bruno <[EMAIL PROTECTED]>

15/06/2006 04:15 PM

To
Dorothy NG/OPS/AH/[EMAIL PROTECTED]
cc
Post all your questions about iText here <[email protected]>
Subject
Re: [iText-questions] Creating PDF using JEditorPane





[EMAIL PROTECTED] wrote:

>
> Hi Bruno,
>
> thanks for replying.
>
> I've tried doing it the below way, but cannot create the PDF
> successfully. When I tried to open the PDF created, the message that
> is returned is:
> "There was an error opening this document. This file is already open
> or in use by another application."

What if you shut down the computer, restart and open test.pdf?
It won't be used by any other application, so it should open perfectly.
br,
Bruno


_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to