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, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

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: 1370
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic »

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: 1370
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 »

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: 1370
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 »

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: 1370
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 »

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
Sasha - Tracker Dev Team
User
Posts: 5522
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 »

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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
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 »

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
Sasha - Tracker Dev Team
User
Posts: 5522
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 »

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
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
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 »

Hi Alex,

ok, thanks. Case closed.

Sasha - Tracker Dev Team
User
Posts: 5522
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 »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply