Hi all,

I'd first like to say that we replaced a closed source PDF engine with iText
about six months ago and have seen smooth sailing since.  (Well, until
today...)

We've started receiving PDFs that do not use /mediabox intructions.  These
files are just a series of full-page fax decodes.  We strip out certain
pages and write them out to another PDF using PDFWriter.getImportedPage().
This function has a dependency on PDFReader.getPageSize() which breaks with
an NPE when no mediabox is speficied.

12:03:18,253 ERROR [STDERR] java.lang.NullPointerException
12:03:18,254 ERROR [STDERR]     at
com.lowagie.text.pdf.PdfReader.getNormalizedRectangle(PdfReader.java:227)
12:03:18,255 ERROR [STDERR]     at
com.lowagie.text.pdf.PdfReader.getPageSize(PdfReader.java:178)
12:03:18,256 ERROR [STDERR]     at
com.lowagie.text.pdf.PdfImportedPage.<init>(PdfImportedPage.java:69)

public Rectangle getPageSize(int index) {
        PdfDictionary page = pages[index - 1];
-->>        PdfArray mediaBox =
(PdfArray)getPdfObject(page.get(PdfName.MEDIABOX));
        return getNormalizedRectangle(mediaBox);
    }

Does anyone have an idea for a work around?

Thanks!
Matt Griffin




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to