-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File exception: UglyToad.PdfPig.Core.PdfDocumentFormatException' was thrown. #860
Comments
I noticed that when I open the file, add one character to a field, save it and reprocess it, it gives no error? |
Anything I can provide in order to support you as efficient as possible? |
Unfortunately this error can be due to basically any unexpected formatting in the source file. Without the source file it is very difficult to tell. The error message suggests the error is happening when trying to find the information near the end of the document which looks like:
It might be possible to get more information about the error locally by debugging the PdfPig code. You can clone this repository and locally set the version of .NET you have available with this script https://github.com/UglyToad/PdfPig/blob/master/tools/set-dotnet-version.ps1 Then you can load the file in a test and see what is going wrong: https://github.com/UglyToad/PdfPig/blob/master/src/UglyToad.PdfPig.Tests/Integration/LocalTests.cs |
Hello @EliotJones, Thanks for the feedback. When I run my code I see the following:
|
Sorry I've basically run out of will-to-continue with this library so you're probably long gone by now. But based on the error you're getting now it sounds like there could be a malformed object in the specific file which PdfPig doesn't yet have a workaround for. What you'd need to find is which object
You can then find the object in the file on the basis of finding the text:
In the file using e.g. Notepad++ and copying everything until the |
Hello,
I found this really nice project because I need to read and process many pdf files.
(At the moment I am using V0.19-Alpha but also tested V0.18)
The pdf file can be opened with adobe, however, when I want to read it with PdfPig an error is thrown:
Once in a while I get the following exception while reading a file: var document = PdfDocument.Open(fileEntry);
'Exception of type 'UglyToad.PdfPig.Core.PdfDocumentFormatException' was thrown.'
UglyToad.PdfPig.Core.PdfDocumentFormatException
HResult=0x80131500
Message=Exception of type 'UglyToad.PdfPig.Core.PdfDocumentFormatException' was thrown.
Source=UglyToad.PdfPig
StackTrace:
at UglyToad.PdfPig.Parser.FileStructure.CrossReferenceParser.Parse(IInputBytes bytes, Boolean isLenientParsing, Int64 crossReferenceLocation, Int64 offsetCorrection, IPdfTokenScanner pdfScanner, ISeekableTokenScanner tokenScanner)
at UglyToad.PdfPig.Parser.PdfDocumentFactory.OpenDocument(IInputBytes inputBytes, ISeekableTokenScanner scanner, InternalParsingOptions parsingOptions)
Since the PDF files are confidential, I cannot share them. What can be the cause?
Thanks.
The text was updated successfully, but these errors were encountered: