OpenPDF
OpenPDF copied to clipboard
NullPointerException in PdfReader.readPages()
I get this NullPointerException in OpenPDF 1.3.27, when calling: reader = new PdfReader(data);
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfReader.readPages(PdfReader.java:1103)
at com.lowagie.text.pdf.PdfReader.readPdf(PdfReader.java:627)
at com.lowagie.text.pdf.PdfReader.
https://github.com/LibrePDF/OpenPDF/blob/master/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java#L1103
Hello, is there a complete test code for this problem? If there is , could you please share the test code to me? So I can reproduce this problem. It will help me to solve this bug. Thank you!
I have such as a PDF file to reproduce this problem, can you please send me an email to andreas.rosdal AT gmail.com and I will share the PDF file with you. Thank you.
The code to reproduce this problem is to read a PDF file using the PdfReader.PdfReader(byte[] pdfIn) constructor. Here: https://github.com/LibrePDF/OpenPDF/blob/master/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java#L195
We still get this error in production when reading some PDF files using OpenPDF 1.3.30.
https://github.com/LibrePDF/OpenPDF/blob/05ff04f1da01052b695443f243d577f724a216d4/openpdf/src/main/java/com/lowagie/text/pdf/PdfReader.java#L1164
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfReader.readPages(PdfReader.java:1164)
at com.lowagie.text.pdf.PdfReader.readPdf(PdfReader.java:627)
at com.lowagie.text.pdf.PdfReader.<init>(PdfReader.java:212)
at com.lowagie.text.pdf.PdfReader.<init>(PdfReader.java:196)
at no.foo.bar.split(PdfDocument.java:91)
@chappyer @asturio