I have my doubts that Image.getInstance("new_logo2.png") finds any image. You are probably ignoring an exception thrown here. Use the full path to the image.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tanya Savage
Sent: Thursday, November 17, 2005 5:25 PM
To: [email protected]
Subject: [iText-questions] inserting image into document get document has no pages error

Hi I am trying to insert an image into a PDF file but it throws a document has no pages error.

 

Here is my code snipet. I am creating this page in a JSP because I am using a bean to pull info out of a DB.

 

PdfWriter.getInstance(document, new FileOutputStream("../webapps/slb/" + myUrlString + ".pdf"));             

document.open();

 

/TRYING TO ADD IMAGE!!!

                          // document.add(new Paragraph("new_logo2.png"));  //This line adds the name of the image to the pdf file

                    //Image png = Image.getInstance("new_logo2.png"); //This line gives me document has no page

                            //document.add(Image.getInstance("new_logo2.png"));             

                           //  Image img = Image.getInstance("new_logo2.png");

 

Thanks for any assistance you can provide.

 

Tanya

 

 

                       

Reply via email to