-
1. Re: How to tell if a change was made to a PDF by a plugin before saving?
BarlaeDC Apr 2, 2012 3:46 AM (in response to Eldrarak82)1 person found this helpfulHi,
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
-
2. Re: How to tell if a change was made to a PDF by a plugin before saving?
Eldrarak82 Apr 2, 2012 5:52 AM (in response to BarlaeDC)Thanks Malcolm, let me take a look at the docs and give that a try
-
3. Re: How to tell if a change was made to a PDF by a plugin before saving?
Eldrarak82 Apr 2, 2012 7:42 AM (in response to Eldrarak82)Okay thanks Malcolm. That did the trick. I will say that in C#, it is a little bit of a chore to get those JS commands to execute correctly, so I will post the code here that worked for anyone else who has this issue and needs the resolution.
private static bool TestDirty(AcroAVDocClass avDoc, AcroPDDoc pdDoc)
{
object jso = pdDoc.GetJSObject();
bool docDirty = false;try
{
if (jso != null)
{
string[] fileToOpenArr = new string[1] { fileToOpen };
object jsApp = jso.GetType().InvokeMember("app", BindingFlags.GetProperty, null, jso, null, null);if (jsApp != null)
{
object jsDocs = jsApp.GetType().InvokeMember("activeDocs", BindingFlags.GetProperty, null, jsApp, null, null);if (jsDocs != null)
{
object[] arrObj = (object[])jsDocs;
object theJSDoc = arrObj[0];object objDirty = theJSDoc.GetType().InvokeMember("dirty", BindingFlags.GetProperty, null, theJSDoc, null, null);
docDirty = Boolean.Parse(objDirty.ToString());
}
}
}
}
catch
{
//Catch thh exception
}return docDirty;
}