Skip to content
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

Unexpected EOF with PdfReader.Open(PdfDocumentOpenMode.Import) when opening a PDF with a textbox and slash #311

Open
nh104622 opened this issue Nov 30, 2022 · 2 comments

Comments

@nh104622
Copy link

nh104622 commented Nov 30, 2022

Basically title. When I try to take in an existing PDF byte array then open up a memory stream to read the PDF then Call PDFReader.Open(...), I get an error message with the below external stack trace. The issue goes away when I take out the slashes in a date text field of the editable PDF. The example PDF has a date in the format of: 01/01/1970 in a textbox. Is there any way around this issue?

using var stream = new MemoryStream(pdfData);
using var doc = PdfReader.Open(stream, PdfDocumentOpenMode.Import);

Stack Trace:
ICSharpCode.SharpZipLib.SharpZipBaseException: Unexpected EOF
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Fill
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read
at PdfSharpCore.Pdf.Filters.FlateDecode.Decode
at PdfSharpCore.Pdf.Filters.Filtering.Decode
at PdfSharpCore.Pdf.PdfDictionary+PdfStream.get_UnfilteredValue
at PdfSharpCore.Pdf.IO.Parser.ReadXRefStream
at PdfSharpCore.Pdf.IO.Parser.ReadXRefTableAndTrailer
at PdfSharpCore.Pdf.IO.Parser.ReadTrailer
at PdfSharpCore.Pdf.IO.PdfReader.Open

@nh104622
Copy link
Author

An update on this issue, I still have this problem with an inconvenient workaround. Basically this PDF I am trying to import has editable fields and generates the above exception when calling PdfReader.Open(...). The workaround is to manually edit one of the fields using Adobe then undo my change and save it. For some reason this seems to work when re-running my application with the above code.

Does anyone have any insights on what could be happening here? This happens with multiple documents.

@toolgood
Copy link

toolgood commented Aug 6, 2024

#451 The same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants