Hi,
        I have written a stand alone program using itext to embed an image into a PDF. The PDF gets created with out any problem. However while reading the PDF we get this error - "Insufficient data for an image". The PDF opens up normally with the Adobe reader 5.0 , we are facing this problem with the version 6.0 and greater. please advise.

here is the snippet of the code :

        Document document = new Document();

        try {
            // create a writer that listens to the document
            // and directs a PDF-stream to a file
            PdfWriter.getInstance(document, new FileOutputStream("Images-itext1.4.pdf"));

            // open the document
            document.open();

              document.setPageSize(PageSize.LETTER.rotate());


            document.add(new Paragraph("Test jpg in PDF"));
            Image jpg = Image.getInstance("C:\\PDFLib\\Itext\\p.jpg");

              jpg.scaleAbsolute(640.00f, 480.00f);

              document.newPage();
              document.add(jpg);

        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
        catch(IOException ioe) {
            System.err.println(ioe.getMessage());
        }

        //close the document
        document.close();

- Thanks,
  Vinay



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to