capture save as event
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 41
- Joined: Tue Aug 31, 2010 8:44 am
capture save as event
Hello,
in my project I want to capture the SaveAs-Dialog after a call to place a digital signature.
but only the following events are fired (see attached sample)
Event name Global::FocusGained
Event name Global::FocusGained
Event name Global::BeginModal
Event name Global::FocusGained
Event name Global::EndModal
What I need is the event as mentioned in the help file:
function OnEvent(Type, Name, DataIn, DataOut, Flags)
{
...
if (Type == PXCVA_OnDisplayPrompt)
...
}
Thanks
Regards
Peter
in my project I want to capture the SaveAs-Dialog after a call to place a digital signature.
but only the following events are fired (see attached sample)
Event name Global::FocusGained
Event name Global::FocusGained
Event name Global::BeginModal
Event name Global::FocusGained
Event name Global::EndModal
What I need is the event as mentioned in the help file:
function OnEvent(Type, Name, DataIn, DataOut, Flags)
{
...
if (Type == PXCVA_OnDisplayPrompt)
...
}
Thanks
Regards
Peter
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am
Re: capture save as event
Hello Peter,
Please zip/rar the sample and reupload it as it didn't work the first time.
Best,
Stefan
Please zip/rar the sample and reupload it as it didn't work the first time.
Best,
Stefan
-
- User
- Posts: 41
- Joined: Tue Aug 31, 2010 8:44 am
Re: capture save as event
now as zip-attachement ...
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am
Re: capture save as event
Thanks Peter,
Asked for some advise from the devs and will post here shortly.
Best,
Stefan
Asked for some advise from the devs and will post here shortly.
Best,
Stefan
-
- User
- Posts: 37
- Joined: Tue Jan 25, 2011 3:11 pm
Re: capture save as event
Hello Peter,
as a C# developer an newbie to PDFXchange I also was a little bit confused about the event handling.
The first thing is that the signature of the event handler method is not as described in the help file.
Nevertheless, maybe my example will help you.
I want to show a special messagebox when a document gets save.
Therefore in need to now when the BeforeSaveDoc event is fired.
When the user does not want to save, I need to set the Cancel flag of the BeforeSaveDoc event.
Here is how I do that:
As you can see, you need to use the SetProperty (or GetProperty) of the corresponding viewer control to read or set settings of the "pseudo" event.
If there is a smarter way to do that, please let me know.
Kind regards,
Tino
as a C# developer an newbie to PDFXchange I also was a little bit confused about the event handling.
The first thing is that the signature of the event handler method is not as described in the help file.
Code: Select all
void viewer_OnEvent(object sender, AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent e) {
I want to show a special messagebox when a document gets save.
Therefore in need to now when the BeforeSaveDoc event is fired.
When the user does not want to save, I need to set the Cancel flag of the BeforeSaveDoc event.
Here is how I do that:
Code: Select all
void viewer_OnEvent(object sender, AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent e) {
var viewer = sender as AxPDFXCviewAxLib.AxCoPDFXCview;
if (e.name == "Notifications.BeforeSaveDoc") {
if (MessageBox.Show("Realy want to save?", "Question", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) {
viewer.SetProperty("Notifications.BeforeSaveDoc.Cancel", 1);
}
}
}
If there is a smarter way to do that, please let me know.
Kind regards,
Tino
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am
Re: capture save as event
Many thanks for the help Tino,
Much appreciated.
All we need is now for Peter to confirm it also works for him
Cheers,
Stefan
Much appreciated.
All we need is now for Peter to confirm it also works for him

Cheers,
Stefan
-
- User
- Posts: 41
- Joined: Tue Aug 31, 2010 8:44 am
Re: capture save as event
Thanks for help. I think every C# event uses this signature: void EventFunc(object sender, object param2)mash_inc wrote:Hello Peter,
as a C# developer an newbie to PDFXchange I also was a little bit confused about the event handling.
The first thing is that the signature of the event handler method is not as described in the help file.Code: Select all
void viewer_OnEvent(object sender, AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent e) {
Unforunately this won't help in VC++, as event handling is different. Perhaps there is also a 2nd undocumented func-sig for VC++ and the ActiveX-Component?
Regards,
Peter
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am
Re: capture save as event
Hi Peter,
I have asked for some help from the guys that are more into it with VC++ and we should get a response here shortly.
Best,
Stefan
I have asked for some help from the guys that are more into it with VC++ and we should get a response here shortly.
Best,
Stefan
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: capture save as event
Hi, Peter
HTH.
Please look to our VC++ examples for PDF-XChange Viewer ActiveX SDK (for example <InstalledSDK>\Examples\CExamples\FullDemo\MainDlg.h/MainDlg.cpp). The C++ signature for event handler:I think every C# event uses this signature: void EventFunc(object sender, object param2)
Unforunately this won't help in VC++, as event handling is different. Perhaps there is also a 2nd undocumented func-sig for VC++ and the ActiveX-Component?
Code: Select all
HRESULT __stdcall OnEvent(/*[in]*/ LONG Type, /*[in]*/ BSTR Name, /*[in]*/ VARIANT DataIn, /*[out]*/ VARIANT* DataOut, /*[in]*/ LONG Flags);
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: 41
- Joined: Tue Aug 31, 2010 8:44 am
Re: capture save as event
Yes, this is exactly my event handler. Please look at my sample code to reproduce the behaviour.Vasyl-Tracker Dev Team wrote:Hi, Peter
Please look to our VC++ examples for PDF-XChange Viewer ActiveX SDK (for example <InstalledSDK>\Examples\CExamples\FullDemo\MainDlg.h/MainDlg.cpp). The C++ signature for event handler:HTH.Code: Select all
HRESULT __stdcall OnEvent(/*[in]*/ LONG Type, /*[in]*/ BSTR Name, /*[in]*/ VARIANT DataIn, /*[out]*/ VARIANT* DataOut, /*[in]*/ LONG Flags);
Regards,
Peter
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: capture save as event
Hi Peter.
Please look to the attached file. Thanks to Tino for good solution
.
NOTE: currently you can sign the documents which already contains the unsigned(!) form fields with special type "Digital Signature", so, if document doesn't contain it then this ExecuteCommand won't work. In the new version (V3) you will be able to detect this case and add unsigned dig-sign. form field before signing..
Best
Regards.
Please look to the attached file. Thanks to Tino for good solution

NOTE: currently you can sign the documents which already contains the unsigned(!) form fields with special type "Digital Signature", so, if document doesn't contain it then this ExecuteCommand won't work. In the new version (V3) you will be able to detect this case and add unsigned dig-sign. form field before signing..
Best
Regards.
You do not have the required permissions to view the files attached to this post.
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: 41
- Joined: Tue Aug 31, 2010 8:44 am
Re: capture save as event
Hi all,
thanks for sample code, but I think we talk past each other
My problem is, that the event is simply not fired. Tested with Visual Studio 6 MFC and Visual Studio 2010 MFC, both with the ActiveX-Control.
See output of afxDump. The string 'Notifications.BeforeSaveDoc' is not in debug output.
Regards,
Peter
thanks for sample code, but I think we talk past each other

My problem is, that the event is simply not fired. Tested with Visual Studio 6 MFC and Visual Studio 2010 MFC, both with the ActiveX-Control.
See output of afxDump. The string 'Notifications.BeforeSaveDoc' is not in debug output.
Code: Select all
void CPDFXEventDlg::OnOnEventCopdfxcview(long Type, LPCTSTR Name, const VARIANT FAR& DataIn, VARIANT FAR* DataOut, long Flags)
{
afxDump << "Event name " << Name << "\n";
if (bDigSigning)
{
if ((Type == PXCVA_OnNamedNotify) && (lstrcmpi(Name, _T("Notifications.BeforeSaveDoc")) == 0))
{
AfxMessageBox("this code will never be executed ...");
//...
Peter
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: capture save as event
Hi, Peter.
What version of SDK is used by you? Should be 2.5.191 because it is new notify...
HTH
What version of SDK is used by you? Should be 2.5.191 because it is new notify...
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 41
- Joined: Tue Aug 31, 2010 8:44 am
Re: capture save as event
Hi Vasyl
Now updated to current version 2.5.191 and problem seems to be solved.
Thanks a lot to all.
Regards
Peter
Installed version was 2.5.0190.Vasyl-Tracker Dev Team wrote:Hi, Peter.
What version of SDK is used by you? Should be 2.5.191 because it is new notify...
HTH
Now updated to current version 2.5.191 and problem seems to be solved.
Thanks a lot to all.
Regards
Peter
-
- Site Admin
- Posts: 19885
- Joined: Mon Jan 12, 2009 8:07 am