detect if document is dirty (need to be saved)

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

nirnir2
User
Posts: 22
Joined: Wed May 15, 2013 9:46 am

detect if document is dirty (need to be saved)

Post by nirnir2 »

Hi,
How can I know if the document was modified and need to be saved (document was rotated,notes added,fields modified...)

Nir
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: detect if document is dirty (need to be saved)

Post by Stefan - PDF-XChange »

Hello Nir,

Please check section 2.2.2.4.1 of the Viewer AX SDK - you need to check the "Objects.Documents.<item>.Modified" flag.

Cheers,
Stefan
Fanski
User
Posts: 33
Joined: Tue Apr 17, 2012 10:33 am

Re: detect if document is dirty (need to be saved)

Post by Fanski »

Hi,

i tryed this property, but when the user is editing a form field, as long as the field has focus the property returns false (0).
Is there a property that will return true after the user pressed the first key?
(the save button in the viewer has this behavior)

Kind regards
Peter
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: detect if document is dirty (need to be saved)

Post by Stefan - PDF-XChange »

Hi Peter,

I will need to check that with our forms expert. Will get back to you when I have more info.

Regards,
Stefan
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: detect if document is dirty (need to be saved)

Post by Stefan - PDF-XChange »

Hi Peter,

This has been passed to a colleague from the dev team (Vasyl) and I will post back here when I have further news.

Best,
Stefan
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: detect if document is dirty (need to be saved)

Post by Vasyl - PDF-XChange »

Hi, Peter.
i tryed this property, but when the user is editing a form field, as long as the field has focus the property returns false (0).
Is there a property that will return true after the user pressed the first key?
(the save button in the viewer has this behavior)
Sorry, no easy way for this currently. But you may try to do it by:

Code: Select all

youreventhandler OnEvent(type, name, ..)
{
   if (  (type == PXCVA_OnNamedNotify) AND (name == "Global::OperationsHistoryChanged")
         OR
         (type == PXCVA_OnPropertyChanged) AND (StrStr(name, "].Modified")  != NULL) // "Documents[<DocID>].Modified"
      )
      {
           int cmdSaveState = 0;
           pdfViewer.GetProperty("Commands[\"Save\"].State", out cmdSaveState, 0);
        
           bool isDirty = (cmdSaveState == 1);
      }
}
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.