Hi,
I have a big problem loading a new document during handling the Notifications.DocSaved or Notifications.BeforeSaveDoc events.
Background:
I have a document repository where user can open and modify docs. To avoid blocking documents the user just gets a copy of the original file into his PDFXChangeViewer.
If he made some changes an wants to save the document, I have to check, if the source has been changed in the meanwhile.
If so, he can solve the conflict by selecting his modified version or the new source document.
In case of selecting the source document, I create again a copy of the source doc and want to load this on into the PDFXChangeViewer.
This process will be triggered by a Notifications.DocSaved or Notifications.BeforeSaveDoc event.
Now the problem raises:
PDFXChangeViewer "hangs" when calling OpenDocument() because he still waits for returning back from event handling routines and can't load the new document.
How can I solve this problem?
Best regards
cew
Load document during handling DocSaved/BeforeSaveDoc
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 213
- Joined: Tue Feb 01, 2011 8:14 am
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: Load document during handling DocSaved/BeforeSaveDoc
Hello Cew,
Asked the guys in our dev team to help me with your case, and we should be able to advise here a bit later.
Best,
Stefan
Asked the guys in our dev team to help me with your case, and we should be able to advise here a bit later.
Best,
Stefan
-
- Site Admin
- Posts: 2448
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Load document during handling DocSaved/BeforeSaveDoc
Hi cew.
Sorry for delay with answer. Currently we have hard work with SDK V3...
If I understand you correctly - you called the "OpenDocument" from the your event-handler for the 'Notifications.BeforeSaveDoc' event?
Try to use asynchronous call in this case. So it might look like to (pseudocode):
HTH
Sorry for delay with answer. Currently we have hard work with SDK V3...
If I understand you correctly - you called the "OpenDocument" from the your event-handler for the 'Notifications.BeforeSaveDoc' event?
Try to use asynchronous call in this case. So it might look like to (pseudocode):
Code: Select all
string docFileNameForAsyncOpen;
eventhandler OnViewerEvent(type, name,...)
{
if ((type == PXCVA_OnNamedNotify) AND (name == 'Notifications.BeforeSaveDoc'))
{
// setup the docFileNameForAsyncOpen value before posting the your custom message to your form
yourForm.PostMessage(MSG_ASYNCOPEN);
}
}
class yourForm
{
void OnMsgAsyncOpen()
{
pdfViewer.OpenDocument(docFileNameForAsyncOpen);
}
}
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 213
- Joined: Tue Feb 01, 2011 8:14 am
Re: Load document during handling DocSaved/BeforeSaveDoc
Thank you!
Best regards,
cew
Best regards,
cew
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am