Skip navigation
Currently Being Moderated

How to tell if a change was made to a PDF by a plugin before saving?

Apr 1, 2012 9:09 PM

Tags: #acrobat #x #pdf #pro #changes #plugin #saving #.net #temp #com

I have a plugin which I have written which is executed via COM by my C#.net 4.0 launcher application. The function of the plugin is to scan the opened PDF for any annotations that are "Launch" annotations, and to update them to either JS actions or to URI actions.

The problem is that some of the documents which will be passed into the plugin do NOT have annotations in them, and so the plugin code is written to do nothing to the documents in this case.

The documents which are modified by the plugin will be saved to location on the local hard drive, however the files that are not edited are simply to be moved to a different location.

 

How can my COM application tell if the opened PDF has been modified by the plugin before saving or copying the file?

 

I was thinking that if I could get an MD5 or a byte array of the temp file which is created by Acrobat as soon as the document is opened, and compare it to the MD5 or byte array of the same temp file after the changes have (or have not) been made to the document, then I would be able to tell if a change had occured. Is this the best way to go about this? Is there a better way?

 

If the temp file is my best bet, is there any way for my COM application to know the name of the temp file when it is created?

Just looking for some ideas or suggestions on how best to tell if the file has been changed or not, before saving it.

 
Replies
  • Currently Being Moderated
    Apr 2, 2012 3:46 AM   in reply to Eldrarak82

    Hi,

     

    As you are using com and C# you could use the JSObject and check the doc.dirty property and this would tell you if the file needed saved.

     

    The documentation for the Doc.dirty property is in the JavaScript Guide included in the SDK.

     

    Hope this helps

     

    Malcolm

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points