Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iTextSharp IOException "Trailer not found"

am using iTextSharp ( .NET 2.0 Vista ). The iTextSharp Version is 4.1.2.0

PdfReader reader = new PdfReader(pdfFile); 

is causing the library to thrown an exception saying "Trailer not found"
The file exists and can be viewed in Adobe no problem Any ideas?

like image 847
Rahul Avatar asked Feb 03 '10 17:02

Rahul


1 Answers

The trailer is a part the structure of a PDF file. If you're getting an error saying it can't be found then the first thing I'd think is your file is corrupt. Being able to open the PDF in a PDF viewer program doesn't necessarily mean the PDF isn't corrupt; I understand that if it's a linearized PDF file the viewer won't attempt to use the trailer.

Does your code throw an IOException for any PDF you attempt to read?

  • If so, then maybe using a more recent version of iTextSharp will help or at least post some code.
  • If not, then I'd work on recreating the PDFs you're trying to process.
like image 108
Jay Riggs Avatar answered Oct 01 '22 11:10

Jay Riggs