Suppress File Save As Dialog after Placing Digital Signature in Doc

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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Suppress File Save As Dialog after Placing Digital Signature in Doc

Post by asamrith@gmail.com »

How can I hide or suppress the File Save As dialog after I placed a Digital Signature on a doc or after signing a doc with a digital signature? I've read the following topic but did not understand how to catch the event after signing the doc and before the File Save As dialog pop up. Thanks for your help.

How to stop Prompt for Saving after adding Digital Signature:
https://forum.pdf-xchange.com/viewtopic.php?f=36&t=16489

How to stop Prompt for Saving after adding Digital Signature
https://forum.pdf-xchange.com/viewtopic.php?f=66&t=35663&p=147985&hilit=save+file+as+dialog#p147985
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Suppress File Save As Dialog after Placing Digital Signature in Doc

Post by asamrith@gmail.com »

Making a bit progress. I'm able to catch the e_document_beforeSave event but still struggling on how to suppress the File SaveAs dialog after clicking ok to digital sign a doc. I just want to do a silent auto save after signing the doc. Can I please get a sample c# code of the explaination below after getting the IPXV_DocSaveEvent?

"What you can do is intercept the e.document.beforeSave event that is being launched before the saving begins. Get the IPXV_DocSaveEvent from it and then you can try removing the PXV_DocSave_Copy flag from the Flags property and also set the pDest to null - this will trigger the normal Save procedure - not the Save As"
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Suppress File Save As Dialog after Placing Digital Signature in Doc

Post by Vasyl-Tracker Dev Team »

Hi Asamrith.

I tried the following code in our \PDFEditorSDKExamples\CSharp\FullDemo sample app:

Code: Select all

...
if (e.nEventID == nIDS[(int)IDS.e_operBeforeExecute])
{
    PDFXEdit.IOperation op = (PDFXEdit.IOperation)e.pFrom;
    if (op != null && op.ID == nIDS[(int)IDS.op_document_addDigitalSignature])
    {
       PDFXEdit.ICabNode pr = op.Params.Root;
       PDFXEdit.IPXC_Document doc = (PDFXEdit.IPXC_Document)(pr["Input"][0].Unknown);
       if (doc != null)
       {
              PDFXEdit.ICabNode opts = pr["Options"];
              opts["AskDestinationFileName"].v = false;
              opts["DestinationFileName"].v = doc.SrcInfo.ActualFileName;
        }
    }
}
- and it causes the silent save of the just signed document to its source file as well.

Note: the saving document to the file on the disk - its a required part of digisinging. You cannot suppress it.

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Suppress File Save As Dialog after Placing Digital Signature in Doc

Post by asamrith@gmail.com »

Any suggestion to bypass this error? I added the code and step through code to make sure path to the pdf file is valid . But, keep getting the error, "Invalid provider type specified" and no digital signature is placed in the doc. Please see image. Thanks for the help
image.png
image.png (68.22 KiB) Viewed 763 times
.... if (e.nEventID == nIDS[(int)IDS.e_operBeforeExecute]) // digital signature
{

PDFXEdit.IOperation op = (PDFXEdit.IOperation)e.pFrom;
if (op != null && op.ID == nIDS[(int)IDS.op_document_addDigitalSignature])
{
PDFXEdit.ICabNode pr = op.Params.Root;
PDFXEdit.IPXC_Document doc = (PDFXEdit.IPXC_Document)(pr["Input"][0].Unknown);
if (doc != null)
{
PDFXEdit.ICabNode opts = pr["Options"];
opts["AskDestinationFileName"].v = false;
opts["DestinationFileName"].v = doc.SrcInfo.ActualFileName;
}
}

}
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Suppress File Save As Dialog after Placing Digital Signature in Doc

Post by Vasyl-Tracker Dev Team »

Can you reproduce this issue with a build starting from v359?

And note: for a digital signature you can only use a certificate that has a private key. For example:
image.png
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Suppress File Save As Dialog after Placing Digital Signature in Doc

Post by asamrith@gmail.com »

The code works and the error was caused by picking Okta signature instead of my personal company generated digital signature. Once I picked my personal company generated digital signature then all is working and digital signature is placed on the doc, see pic attached. Thanks so much for your help :D
image.png
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6837
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Suppress File Save As Dialog after Placing Digital Signature in Doc

Post by Paul - Tracker Supp »

Yay!

:)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply