ITextSharp IOException "Trailer not found"

am using iTextSharp (.NET 2.0 Vista). ITextSharp version is 4.1.2.0

PdfReader reader = new PdfReader(pdfFile); 

raises an exception in the library saying "Trailer not found"
The file exists and can be viewed in Adobe without problems. Any ideas?

+4
source share
1 answer

The trailer is part of the structure of the PDF file. If you get an error saying that it cannot be found, the first thing I think is your file is damaged. The ability to open a PDF in a PDF viewer does not necessarily mean that the PDF is not damaged; I understand that if it is a linearized PDF file, the viewer will not try to use the trailer.

Does your code provide an IOException for any PDF you are trying to read?

  • If so, then perhaps using a more recent version of iTextSharp will help, or at least post some code.
  • If not, then I would work on recreating the PDF files you are trying to process.
+2
source

Source: https://habr.com/ru/post/1300202/


All Articles