Note that there are some explanatory texts on larger screens.

plurals
  1. POitextsharp NullReferenceException (PageRefs)
    text
    copied!<p>I am using itextsharp 5.4.2 to open a library of pdf documents (all generated programatically using the same pdf generation tool, albeit possibly different versions of that tool). itextsharp is working fine for all the documents except one, which is throwing an exception (the document opens fine in acrobat pdf reader):</p> <pre><code>System.NullReferenceException: Object reference not set to an instance of an object. at iTextSharp.text.pdf.PdfReader.PageRefs.IteratePages(PRIndirectReference rpage) at iTextSharp.text.pdf.PdfReader.PageRefs.ReadPages() at iTextSharp.text.pdf.PdfReader.PageRefs..ctor(PdfReader reader) at iTextSharp.text.pdf.PdfReader.ReadPages() at iTextSharp.text.pdf.PdfReader.ReadPdf() at iTextSharp.text.pdf.PdfReader..ctor(Byte[] pdfIn, Byte[] ownerPassword) at iTextSharp.text.pdf.PdfReader..ctor(Byte[] pdfIn) </code></pre> <p>I also tried to open the same document in iText RUPS 5.4.2 and got the following error while "Reading the Cross-Reference table":</p> <pre><code>Exception in thread "Thread-7" ExceptionConverter: com.itextpdf.text.exceptions.InvalidPdfException: Invalid object number. at file pointer 66562 at com.itextpdf.text.pdf.PRTokeniser.throwError(PRTokeniser.java:199) at com.itextpdf.text.pdf.PdfReader.readSingleObject(PdfReader.java:1171) at com.itextpdf.text.pdf.PdfReader.getPdfObject(PdfReader.java:1076) at com.itextpdf.text.pdf.PdfReader.getPdfObjectRelease(PdfReader.java:1057) at com.itextpdf.rups.model.IndirectObjectFactory.storeNextObject(IndirectObjectFactory.java:88) at com.itextpdf.rups.model.ObjectLoader.doTask(ObjectLoader.java:97) at com.itextpdf.rups.model.BackgroundTask$2.run(BackgroundTask.java:60) at java.lang.Thread.run(Unknown Source) </code></pre> <p>I cannot provide the pdf document (client information), nor can I 'fix' the pdf (3rd party). Without me having to delve in iTextSharp source code, would I be so lucky that the above info would be enough for someone to modify iTextSharp to handle this issue (I suspect the document has a real issue, but it seems like iTextSharp could work around the issue just like pdfreader does?).</p> <p>PDF bytes (66500 - 66600 => 103c4 - 10428; I just opened the pdf in ultra edit. Is the pdf compressed? Are the byte counts from the error message from the compressed stream or uncompressed?)</p> <pre><code>000103c0h: 06 A8 4E 51 B9 1A EC 18 21 D5 08 10 95 96 06 E6 ; .¨NQ¹.ì.!Õ..•–.æ 000103d0h: B9 65 30 30 B0 25 00 B9 40 0A 2A C4 96 01 11 49 ; ¹e00°%.¹@.*Ä–..I 000103e0h: 4B 83 CA 29 29 A9 65 40 9C 05 94 07 B3 81 A2 A1 ; KƒÊ))©e@œ.”.³¢¡ 000103f0h: A1 78 3C 04 04 DA 0C 8C 71 91 40 5A 18 88 45 C1 ; ¡x&lt;..Ú.Œq‘@Z.ˆEÁ 00010400h: 22 CA 0C 3C AC 1F 56 4A 27 B6 49 1B 70 71 4F D8 ; "Ê.&lt;¬.VJ'¶I.pqOØ 00010410h: CB B4 E0 F8 D4 05 0C 52 0B F6 4B 14 EC 5D A6 6C ; Ë´àøÔ..R.öK.ì]¦l 00010420h: 74 F0 C2 61 C9 0D 10 EF EB 32 30 26 FC 05 D2 4C ; tðÂaÉ..ïë20&amp;ü.ÒL 00010430h: 40 6C 0B C4 C6 0C 8C 05 67 40 F6 03 11 23 40 80 ; @l.ÄÆ.Œ.g@ö..#@€ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload