Omit prompt display after click visible digital sign field

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

marcoscmonteiro
User
Posts: 37
Joined: Thu Jan 01, 1970 12:00 am

Omit prompt display after click visible digital sign field

Post by marcoscmonteiro »

After clicking on a visible digital sign field, viewer displays a prompt with informations about digital sign and certificate. I would like to omit display or capture this event because I do my own validation which can be different in terms of validity.

Any way to omit this prompt? I prefer to capture the event before prompt display so I can display my own validation...

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

Re: Omit prompt display after click visible digital sign fie

Post by Vasyl - PDF-XChange »

Hi, marcoscmonteiro.

You may use following method (pseudocode):

Code: Select all

// enable intercepting for mouse-up event:
pdfViewer.SetProperty("Notifications.Mouse.Filter", "Up");
...
youreventhandler OnEvent(type, name, ...)
{
     if ((type == PXCVA_OnNamedNotify) AND (name == "Notifications.Mouse"))
     {
          int msg = 0;
          pdfViewer.GetProperty(name + ".msg", out msg, 0);
          if (msg == 0x0202) // WM_LBUTTONUP
          {
                int docID = 0;
                pdfViewer.GetProperty(name + ".Document", out docID, 0);
                if (docID > 0) 
                {
                      string fieldName;
                      pdfViewer.DoDocumentVerb(docID, "", "GetSelectedField", out fieldName, 0);
                      if (!fieldName.IsEmpty() AND IsMyDigitField(fieldName))  // you may use the JavaScript to obtain more details about selected field 
                      {
                            pdfViewer.SetProperty(name + ".Skip", 1, 0); // to skip default processing of this mouse-up event
                            ::ReleaseCapture(); // standard windows function, use existing equivalent in your programming language, 
                                                  // should be called because previous mouse-down event captured the mouse
                            DoDisplayYourDigSignInfoDlg(); // I recommend to display it asynchronously 
                                                                // because if you called yourDlg.DoModal() here - it will entirely block the UI of our ActiveX control for all DoModal() time...
                      }
                }
          }
     }
}
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.
marcoscmonteiro
User
Posts: 37
Joined: Thu Jan 01, 1970 12:00 am

Re: Omit prompt display after click visible digital sign fie

Post by marcoscmonteiro »

It works!

But I have 2 doubts:

First:

In the code

Code: Select all

string fieldName;
pdfViewer.DoDocumentVerb(docID, "", "GetSelectedField", out fieldName, 0);
the fieldName value is not exactly equal to my signature field name extract by another PDF tool (ITextSharp). In ITextSharp field name does not have ".0" string at the end. For example:

IText field name: "SIGN_FIELD_NAME"
PDFXChange field name: "SIGN_FIELD_NAME.0"

Can I simply remove ".0" from PDFXChange field name? Or others diferences can be encountered?

Second:

How can I get the field type so I can be sure that signature field has been clicked (not another one with the same name of a signature field)?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Omit prompt display after click visible digital sign fie

Post by Vasyl - PDF-XChange »

Can I simply remove ".0" from PDFXChange field name? Or others diferences can be encountered?
".0" means ".<IndexOfWidgetInField>" - one field can be presented by more than one widget...
Sure, you can remove this suffix. There should be no other differences.
How can I get the field type so I can be sure that signature field has been clicked (not another one with the same name of a signature field)?
You may use the following method:

Code: Select all

fieldName = RemoveWidgetIndex(fieldName);
string jsScript =
"var f = this.getField("" + clearFieldName + ""); if (f != null) f.type;" 
string res;
pdfViewer.RunJavaScript(jsScript, out res, docID); // docID - optional
bool bIsSignField = (res == "signature");
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.
marcoscmonteiro
User
Posts: 37
Joined: Thu Jan 01, 1970 12:00 am

Re: Omit prompt display after click visible digital sign fie

Post by marcoscmonteiro »

Thanks again!

One more doubt concerning digital signatures.

When I move cursor mouse over digital sign field PDFXChange shows a tooltip about validation status. Can I omit or change this tooltip to show my own message about validation result? For now I'm using "Commenting.ShowTooltips" = 0 property to omit all tooltips. This does not seem the ideal solution...
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Omit prompt display after click visible digital sign fie

Post by Vasyl - PDF-XChange »

Sorry, but there is no other way to turn it off and no way to change it in the current release I'm afraid.

The good news is that you will be able to do it using our new version of SDK (V3) when it is available later this year.

Best
Regards.
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.