[PDFNet] IsModified seems to frequently be true, when seemingly, no changes have been made

Hi Mike,

When PDFNet opens a corrupted PDF document, it will fix the PDF and set the IsModified flag to true. When you save the modified PDF it saves the fixed version, so it no longer needs to be fixed (modified) when it is opened again, which is why your workaround works. Corrupt PDF documents are quite common, so this is likely the reason why you are seeing IsModified set to true immediately after you’ve loaded it.
James

Hi Mike,

I’m not aware of any product that simply checks a PDF’s validity. The PDF spec is over 1000 pages large, and does at times contain ambiguity, so it would be impossible to be 100% “correct” in any case. If you are worried that the file is being corrupted during the file transfer process you could take the MD5 (or similar) hash of the file on the server and then again on the iPad, and verify they are the same.
James

On Thu, Apr 18, 2013 at 5:17 AM, [email address] via PDFTron PDFNet SDK <pdfnet-sdk+noreply-APn2wQdQvt14w1twujdsDfE_nR7HIfP3VnOJjxo7en3lQ@googlegroups.com> wrote:

Hi,

I will test this with some different documents. Do you know of a PDF validator or something so I could test the source PDF’s validity, so I can ensure it is actually the PDF thats corrupt, rather than the code I am using to download it from the server and save it in my iPad app?

Thanks,

Mike

On Wednesday, 17 April 2013 17:30:26 UTC+1, James wrote:

Hi Mike,

When PDFNet opens a corrupted PDF document, it will fix the PDF and set the IsModified flag to true. When you save the modified PDF it saves the fixed version, so it no longer needs to be fixed (modified) when it is opened again, which is why your workaround works. Corrupt PDF documents are quite common, so this is likely the reason why you are seeing IsModified set to true immediately after you’ve loaded it.

James


You received this message because you are subscribed to the “PDFTron PDFNet SDK” group (http://www.pdftron.com/pdfnet/forum.html).

You received this message because you are subscribed to the Google Groups “PDFTron PDFNet SDK” group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-sdk+unsubscribe@googlegroups.com.
To post to this group, send email to pdfnet-sdk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You can detect files that PDFNet can fix on the fly using doc.IsModified().

If IsModified() returns true, it means that there were some corruptions that caused changes in the document.

This way you can flag these files for review…

Please keep in mind that in PDFNet can also process many corrupt PDF for which doc.IsModified() may not return true.

I'm experiencing the same behavior. When opening a local file it immediately sets the IsModified flag to true. When saving the file and opening again it keeps telling me the document is modified. What could be wrong?

I’m experiencing the same behavior. When opening a local file it immediately sets the IsModified flag to true. When saving the file and opening again it keeps telling me the document is modified. What could be wrong?

As mentioned above, this usually means that the file is corrupt and that PDFNet managed to recover some information.