e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 668
Joined: Thu Sep 05, 2019 12:35 pm

e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by zarkogajic » Wed Feb 12, 2020 9:59 am

Hi Support,

From what I can see, the order of events when saving a document is:

e.document.beforeSave
e.document.performSave
e.document.savePerformed
e.document.afterSave

What happens/can happen between e.document.beforeSave /e.document.performSave, and also between e.document.savePerformed / e.document.afterSave ?

Why: I have a document open in IPXV_PagesPreviewCtl, if the same document is open in pxvControl and edited -> trying to save would result in an error (as the document is locked by IPXV_PagesPreviewCtl).

I'm trying to figure out the best place and the set of actions to close the document in IPXV_PagesPreviewCtl, therefore allowing it to be saved, and reopen in IPXV_PagesPreviewCtl.

I'm thinking of checking if the document, about to be saved, is open in IPXV_PagesPreviewCtl in e.document.performSave. If so, close it in preview, and then reopen in e.document.savePerformed.

I need to be sure nothing can "hit me" by the two other events...


-žarko

zarkogajic
User
Posts: 668
Joined: Thu Sep 05, 2019 12:35 pm

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by zarkogajic » Wed Feb 12, 2020 11:23 am

Hi,

Ok, so e.document.beforeSave raises the Save dialog and if not canceled the e.document.performSave is executed.

How do I get the name of the file to be saved (from IID_IPXV_DocSaveEvent) in e.document.performSave?

p.s.
If successfully saved: what happens between e.document.savePerformed / e.document.afterSave is still an open question :)


zarkogajic
User
Posts: 668
Joined: Thu Sep 05, 2019 12:35 pm

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by zarkogajic » Wed Feb 19, 2020 9:28 am

Hi Support,

?

To repeat:

How do I get the name of the file to be saved (from IID_IPXV_DocSaveEvent) in e.document.performSave?

And can it somehow be changed between e.document.savePerformed and e.document.afterSave ?


zarkogajic
User
Posts: 668
Joined: Thu Sep 05, 2019 12:35 pm

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by zarkogajic » Wed Feb 19, 2020 3:02 pm

Hi Support,

I've made progress...

If I do a simple Save, then IPXV_DocSaveEvent.Doc.CoreDoc.SrcInfo.ActualFileName would have the file name.

If I do "Save As" or "Save Copy As" then IPXV_DocSaveEvent.Dest will be IAFS_Name and from there I can get the file name to be saved as.

Confirm? Can IPXV_DocSaveEvent.Dest be something else?

p.s.
This remains: what can happen between e.document.savePerformed and e.document.afterSave ?

-žarko

User avatar
Sasha - Tracker Dev Team
User
Posts: 4938
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by Sasha - Tracker Dev Team » Wed Feb 19, 2020 3:33 pm

Hi zarkogajic,

The Dest property will always return the IAFS_Name interface if everything is OK.
There is nothing happening between those events as of now (doubt that this will be changed).

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 668
Joined: Thu Sep 05, 2019 12:35 pm

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by zarkogajic » Wed Feb 19, 2020 3:41 pm

Hi Alex,

Thanks for the follow up.

Btw, it seems Dest will be null if a simple "Save" (an existing open document) is executed.

-žarko

User avatar
Sasha - Tracker Dev Team
User
Posts: 4938
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave  SOLVED

Post by Sasha - Tracker Dev Team » Thu Feb 20, 2020 8:04 am

Hi žarko,

Yes, that's the logic behind it - if we are saving into the current document then the Dest will be null.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 668
Joined: Thu Sep 05, 2019 12:35 pm

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by zarkogajic » Thu Feb 20, 2020 12:31 pm

Hi Alex,

ok, thanks. Case closed.


User avatar
Sasha - Tracker Dev Team
User
Posts: 4938
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Post by Sasha - Tracker Dev Team » Thu Feb 20, 2020 12:50 pm

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply