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

"Object reference not set to an instance of an object." #874

Open
rklec opened this issue Aug 6, 2024 · 1 comment
Open

"Object reference not set to an instance of an object." #874

rklec opened this issue Aug 6, 2024 · 1 comment

Comments

@rklec
Copy link

rklec commented Aug 6, 2024

STR

PdfDocument.Open(pdfBytes) with the some PDF file. As it contains sensitive data, i unfortunately cannot attach it here and I was unfortunately unable to create a minimal example, but some hints:

  • it was a quite complex one with images and some header etc. (not much text though)
  • contains some comments shown on hover (but not with the Acrobat icon it usually shows)
  • it was last edited with Firefox and some notes and drawings were added
  • it was last edited at 2023-08/2023-09

Much like this and I tried to reproduce it with this example, but it does not work:
grafik

Thus, i only attach this image, because with the PDF I've created it is not reproducible.

What happens

System.NullReferenceException
  HResult=0x80004003
  Nachricht = Object reference not set to an instance of an object.
  Quelle = UglyToad.PdfPig
  Stapelüberwachung:
   bei UglyToad.PdfPig.PdfExtensions.TryGet[T](DictionaryToken dictionary, NameToken name, IPdfTokenScanner tokenScanner, T& token)

Apparently, this is the line of failure:

if (!dictionary.TryGet(name, out var t) || !(t is T typedToken))

What should happen

At least PdfDocumentFormatException if you consider the file invalid.

However, IMHO, the file is valid an can be opened with both Adobe Acrobat Reader and Firefox. Thus, actually parsing it would be good.

Also, when opening it with Adobe Acrobat Reader and re-saving it, it can be parsed!

System

PDFPig 0.1.8
reproducible on Windows 10

Interne Referenz: 2118

@BobLd
Copy link
Collaborator

BobLd commented Aug 6, 2024

Hi @rklec it's going to be complicated to help you without the document...

Can you try with the latest version of PdfPig (pre-release 1.9.0, available via Nuget packages)?

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