I use the following code to create a PdfReader instance:
FileInputStream pdfIn = new FileInputStream("c:/temp/20501217.pdf");
ByteArrayOutputStream stampedPdfBAOS = new ByteArrayOutputStream();
try {
PdfReader reader = new PdfReader(pdfIn);
This throws an exception producing the following stack trace:
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.get(ArrayList.java:323)
at com.itextpdf.text.pdf.PdfReader.removeUnusedNode(PdfReader.java:3042)
at com.itextpdf.text.pdf.PdfReader.removeUnusedObjects(PdfReader.java:3086)
at com.itextpdf.text.pdf.PdfReader.readPdf(PdfReader.java:528)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:237)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:247)
I'm using iText version 5.0.4, and the PDF is valid.