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