Hello,
I need to read the metadata of PDF documents, it works fine with PdfSharp, but for some PDFs (see attached to reproduce the problem) the following warning is launched:
Quote:
Code:
warn: default category[0]
Another instance of object 14532 0 R was found. Using previously encountered object instead.
with the number
14532 being "random" (it probably isn't that random, but by that I mean it changes with patological pdfs). This warning message always appears when at least two PDF files are involved, but for some PDFs their combination does not produce the message. Here's the code (F#) I use to produce this warning message (I use the
NuGet version of PdfSharp 6.0.0):
Code:
open PdfSharp.Pdf.IO
let file1 = "Modern Computer Algebra.pdf"
let file2 = "Scientific Programming with Maxima.pdf"
let a = PdfReader.Open file1
let b = PdfReader.Open file2
Then, the terminal show this:
Quote:
Code:
warn: default category[0]
Another instance of object 14532 0 R was found. Using previously encountered object instead.
warn: default category[0]
Another instance of object 14532 0 R was found. Using previously encountered object instead.
If I only open one of the files, then no message appears. I tried to close (after use) the open pdfs (
a.Close() and
b.Close()) thinking it might cause the error, but apparently not.
I haven't found a way to silence this warning, nor to correct the problem it seems to raise, I need to read thousands of PDFs this way and the terminal displays hundreds of such warnings, which is quite annoying. What can I do to solve this "problem"?
PS: Here's
a WeTransfer link for the files in question (they're too large for the forum)