Exception on getPageIterator: Attempt to load a free object Conditional expression: obj.IsFree() == false

Product: PDFNetC64

Product Version: 8.0.0 / 9.5.3

Please give a brief summary of your issue:
Exception from within document.getPageIterator ()

Please describe your issue and provide steps to reproduce it:
We’re having an exception while trying to iterate document pages.

This is the exception:

com.pdftron.common.PDFNetException: Exception: Message: Attempt to load a free object Conditional expression: obj.IsFree() == false Version : 9.3.0-8832761 Platform : Linux Architecture : AMD64 Filename : SDFDocImpl.cpp Function : LoadObj Linenumber : 1269 at com.pdftron.pdf.PDFDoc.GetPageIteratorBegin(Native Method) at com.pdftron.pdf.PDFDoc.getPageIterator(PDFDoc.java:1225) at pdftronmanager.PDFTronManager.generateXfdf(PDFTronManager.java:1147) at pdftronmanager.PDFTronManager.main(PDFTronManager.java:313).

Our code is similar to the provided in the example:

    PDFDoc document = new PDFDoc (pdfPath);
    document.initSecurityHandler ();


FDFDoc fdfDoc = FDFDoc.createFromXFDF (outputXfdfPath);
document.fdfMerge (fdfDoc);

        for (PageIterator itr = document.getPageIterator (); itr.hasNext (); ) // in this line the exception is thrown
        {

This works ok for most of the pdfs, however we found one that produces that exception.

Do you have any idea about what could be causing this?

Thank you very much.

Please provide a link to a minimal sample where the issue is reproducible:

Unfortunately I can’t share the PDF because is private content.

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

This works ok for most of the pdfs, however we found one that produces that exception.

This means it is a malformed PDF file, and does not conform to the PDF specification somehow.

Unfortunately I can’t share the PDF because is private content.

Then the only option would be to contact the author/owner of the PDF file and ask them to repair the file. Perhaps just opening and resaving might work, or better yet, regenerate the file.

Thank you very much Ryan.

An odd thing that’s happening is that in our dev environment, we found the original pdf works ok. However, in other environments (qa, staging, prod) it does not work. The environments have pretty the same things (docker + containers). We’ll contact the PDF’s owner anyway to explore that possibility.

Thanks again.