ststeiger / PdfSharpCore

Port of the PdfSharp library to .NET Core - largely removed GDI+ (only missing GetFontData - which can be replaced with freetype2)
Other
1.05k stars 234 forks source link

Cant open/read pdf #362

Open KlaskSkovby opened 1 year ago

KlaskSkovby commented 1 year ago

PdfSharpCore fails to open these two pdfs. looks like two different issues.

I have tried opening in accuracy.moderate with no luck PdfDocument document = PdfReader.Open(path, PdfDocumentOpenMode.Import, PdfSharpCore.Pdf.IO.enums.PdfReadAccuracy.Moderate);

Both pdf can be opened in Adobe and Bluebeam

Detaljer ARGO KOD rev.B.pdf 20-0193 - GR.10 BJÆLKER. ENDELIGE.pdf

jafin commented 1 year ago

@KlaskSkovby, the PDF appears to have a validation error If you use the tool at https://github.com/pdfcpu/pdfcpu It reports:

validation error (obj#:345): dict=pagesDict entry=VP: unsupported in version 1.4
This file could be PDF/A compliant but pdfcpu only supports versions <= PDF V1.7

Other libraries appear to be relaxed on this and let the file open, perhaps this library is not. If I open and "repair" the file in Adobe Acrobat, then it works fine via pdfsharpcore.

Is there anything you can look at in the package that produces the pdf? Attached is the file you provided but saved via Acrobat. This passes pdfcpu without error and can be read by pdfsharpcore

Detaljer ARGO KOD rev.B-acrobat.pdf