How to stop Prompt for Saving after adding Digital Signature

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

patient chart manager, llc
User
Posts: 29
Joined: Thu Jan 03, 2013 7:43 pm

How to stop Prompt for Saving after adding Digital Signature

Post by patient chart manager, llc »

Hi, I realize that when a digital signature is applied, a save should occur, because after that, if user edited, then signature would indicate changes made etc, but, is there any way to just have a regular popup to save yes/no as you do when document is dirty and you close viewer, instead of having to choose a file to save to etc.

Thanks
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7361
Joined: Wed Mar 25, 2009 10:37 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Paul - PDF-XChange »

Hi patient chart manager, llc

there is no way in the current End User Viewer to do this. We have been asked this before and have added it to the feature wish list. I can't promise if it will be delivered but it's least on the radar. I'll need to get one of the dev team to comment on if this can be done with the SDK.

Look for an answer here.

hth
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
patient chart manager, llc
User
Posts: 29
Joined: Thu Jan 03, 2013 7:43 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by patient chart manager, llc »

Ok, well, this is so critical because no reason that the user inside my program should be allowed access to the file system, to choose where they want to save the file, even if there was a way to eliminate that dialog, and just when user answers yes to save, at least not getting another dialog that gives them unfettered access to the file system.

Best suggestion for implementation would be to cache the signing, so in case users makes a few more changes, that applied digital signature is indeed done after all edits are finished.

Thanks
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Vasyl - PDF-XChange »

Hi, patient chart manager llc

I can suggest you one way to suppress the 'Save As' dialog and save signed document silently.

Code: Select all

bool g_bSigningDoc = false;
...
g_bSigningDoc = true;
DoVerb(null, "ExecuteCommand", DataIn("SignDocument"), null, 0);
g_bSigningDoc = false;
...
youreventhandler OnEvent(type, name..)
{
   if (g_bSigningDoc && (type == PXCVA_OnNamedNotify) AND (name == "Notifications.BeforeSaveDoc"))
   {
         // get current source file name
         int docID;
         pdfViewer.GetProperty("Notifications.BeforeSaveDoc.DocID", out docID, 0);
         string fileName;
         pdfViewer.GetDocumentProperty(docID, "FileName", out fileName, 0);
         // to save to source file
         pdfViewer.SetProperty("Notifications.BeforeSaveDoc.DestFileName", fileName, 0);
         pdfViewer.SetProperty("Notifications.BeforeSaveDoc.SaveMode", 0, 0);
   }
}
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.
patient chart manager, llc
User
Posts: 29
Joined: Thu Jan 03, 2013 7:43 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by patient chart manager, llc »

Ok, well, that is a big help, but, there is still the dialog that pops up asking you to confirm whether you want to use incremental saving or not, and hard to see why that should come up if this statement is used as you show:

pdfViewer.SetProperty("Notifications.BeforeSaveDoc.SaveMode", 0, 0);

I also use that command even before loading the document, but does not matter, still one more dialog, but certainly much better than before. Please advise if there is anyway still that final dialog can be suppressed, as I always want full save, not incremental, and bothersome to see that.

Thanks for the help, hope we have this final piece of the puzzle.
patient chart manager, llc
User
Posts: 29
Joined: Thu Jan 03, 2013 7:43 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by patient chart manager, llc »

Ok, sorry, my mistake, I forgot to add to this notification:

Call PDFX1.setProperty("Prompts.ConfirmDocumentIncSave.UserChoice", "No", 0)
:D
and that fixed the issue, thanks so much, made my day
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7361
Joined: Wed Mar 25, 2009 10:37 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Paul - PDF-XChange »

Awesome to hear.

:-)
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Dorwol »

Hi,

I have the same problem and I have test your solution. But it doesn't work.

The Problem is, that immediately after "ExecuteCommand" the g_bSigningDoc will set to "False". But at this time the signature is not yet inserted. And after signature-insert the "OnEvent" fires, but g_bSigningDoc is already "False" at this time.

g_bSigningDoc = True
DoVerb(null, "ExecuteCommand", DataIn("SignDocument"), null, 0);
g_bSigningDoc = False

So what am I doing wrong?

BTW: No "ConfirmDocumentIncSave" Event fires! Why?
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Dorwol »

Meanwhile, I've tried everything, but it does not work.

Any advice for me?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Vasyl - PDF-XChange »

Hi, Dorwol.
The Problem is, that immediately after "ExecuteCommand" the g_bSigningDoc will set to "False".
It may occur when your document doesn't contain any unsigned 'digital-signature' fields. In this case the command 'SignDocument' only activates the 'Place Signature' end-user's tool and returns immediately without any dialogs. After this user will be able to place 'digital-signature' field by mouse clicking on the page. So for your case the document must have one unsigned 'digital signature' field...

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.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Vasyl - PDF-XChange »

BTW: No "ConfirmDocumentIncSave" Event fires! Why?
The same reason: it looks like that your document doesn't contain any 'digital signature' fields..
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.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Dorwol »

I'm not sure if I understood you correctly. Before I call "Sign Document", I have an unsigned 'digital signature' field to add?

Strange but how do I do that? In the instructions I found no command to do this?
Can you give me a pseudo-code please?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Stefan - PDF-XChange »

Hi Dorwol,

Ivan explains the differences between Place Signature and Sign Document here:
https://forum.pdf-xchange.com/ ... hp?p=28552

So have you tried calling the PlaceSignature (ID: 36517) command instead?

Regards,
Stefan
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Dorwol »

> So have you tried calling the PlaceSignature (ID: 36517) command instead?
Already yesterday tested. But exactly the same bad result! :?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Vasyl - PDF-XChange »

Sorry, the 'PlaceSignature' cannot help you. It only activates the end-user's tool for placing signature fields on the pages. Currently is no way to add the empty, unsigned signature-field that can be used by "SignDocument" operation.
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.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Dorwol »

-
And why it works for "patient chart manager, llc"?
patient chart manager, llc wrote:and that fixed the issue, thanks so much, made my day
So the question is still "How to stop Prompt for Saving after adding Digital Signature"?

Is there a way for detecting the reason for the "Notifications.BeforeSaveDoc" event?
Is there a way for detecting if "Sign-Tool mousepointer" is still activated?
Is there any other way? I need the possibility for saving a signed document in the database only and not as file by asking the user for any filename! :|
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Vasyl - PDF-XChange »

Hi, Dorwol.
Is there a way for detecting the reason for the "Notifications.BeforeSaveDoc" event?
Currently - is no way. But in new build we can add simple string prop than can be used like:

Code: Select all

youreventhandler OnEvent(type, name..)
{
   if ((type == PXCVA_OnNamedNotify) AND (name == "Notifications.BeforeSaveDoc"))
   {
         // check for reason
         string saveReason;
         pdfViewer.GetProperty("Notifications.BeforeSaveDoc.Reason", out saveReason, 0);
         if (saveReason != "sign")
             return; // default procedure
         // get current source file name
         int docID;
         pdfViewer.GetProperty("Notifications.BeforeSaveDoc.DocID", out docID, 0);
         string fileName;
         pdfViewer.GetDocumentProperty(docID, "FileName", out fileName, 0);
         // to save to source file
         pdfViewer.SetProperty("Notifications.BeforeSaveDoc.DestFileName", fileName, 0);
         pdfViewer.SetProperty("Notifications.BeforeSaveDoc.SaveMode", 0, 0);
   }
   else if ((type == PXCVA_OnDisplayPrompt) AND (name == "Prompts.ConfirmDocumentIncSave"))
   {
         pdfViewer.SetProperty("Prompts.ConfirmDocumentIncSave.UserChoice", "yes", 0); // to skip possible asking about incremental save when you signing
   }
}
-this feature will be available soon.
Is there a way for detecting if "Sign-Tool mousepointer" is still activated?

Code: Select all

string activeToolName;
pdfViewer.GetProperty("Tools.Active", out activeToolName, PXCVA_GetNamed);
if (activeToolName == "DigSign")
{
    .... 
}
Also you may catch:

Code: Select all

youreventhandler OnEvent(type, name..)
{
   if ((type == PXCVA_OnPropertyChanged) AND (name == "Tools.Active"))
   {
        string activeToolName;
        pdfViewer.GetProperty("Tools.Active", out activeToolName, PXCVA_GetNamed);
        ...
   }
}
BUT will be still unclear situations when you signing document that:
1. has not any empty(unsigned) signature-fields - in this case the "SignDocument" will activate the "DigSign" tool. User must choose page, position on page, and click mouse. The "Sign Document" dialog will be shown.
2. has more one empty signature-fields - in this case the "SignDocument" will warn user about this situation. User must choose necessary field on page and click it. The "Sign Document" dialog will be shown.

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.
Dorwol
User
Posts: 275
Joined: Mon Aug 04, 2008 5:04 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Dorwol »

> unclear situations when you signing document that
The first one: (User must choose page, position on page, and click mouse. The "Sign Document" dialog will be shown)

> if (activeToolName == "DigSign")
Cool! :mrgreen:

> if (saveReason != "sign")
Perfect! :twisted:

> But in new build
Any timeframe for me? Next month?

Have a good day! :D
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to stop Prompt for Saving after adding Digital Signa

Post by Vasyl - PDF-XChange »

> But in new build
Any timeframe for me? Next month?
Approximately - in 1.5 weeks.
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.