Page 1 of 1

Javascript alert

Posted: Fri Aug 04, 2017 2:45 pm
by HelloThere
Hi !

We have a lot of PDF file that using the Alert Javascript function to notify users about validations (Ex : Wrong date format).

Is there a way to catch somewhere if Alert, Beep or call refering to app variable is been throwed ?

Thanks !

JP

Re: Javascript alert

Posted: Fri Aug 04, 2017 7:26 pm
by Alex
Hello,
We have a lot of PDF file that using the Alert Javascript function to notify users about validations (Ex : Wrong date format).
Is there a way to catch somewhere if Alert, Beep or call refering to app variable is been throwed ?
Yes, you can catch when the alert function is called in JavaScript code of PDF document. For doing this you need override the "alert" method in WinFormsPdfJsApp class:
https://www.vintasoft.com/docs/vsimagin ... alert.html

For evaluating the functionality in our PDF Editor Demo you need do the following steps:
  • Open PDF Editor Demo in Visual Studio
  • Open file "PdfDemosCommonCode\DemosCommonCode.Pdf\JavaScript\PdfViewerJsApp.cs" in project PdfDemosCommonCode
  • Override the alert method in PdfViewerJsApp class:

    Code: Select all

    public override int alert(string cMsg, int nIcon, int nType, string cTitle, PdfJsDoc oDoc)
    {
        ...
    }
    
  • Run PDF Editor Demo
  • Open PDF document, which calls the alert function in JavaScript code
Best regards, Alexander