Javascript alert

Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.

Moderator: Alex

Post Reply
HelloThere
Posts: 1
Joined: Fri Aug 04, 2017 2:36 pm

Javascript alert

Post 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
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: Javascript alert

Post 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
Post Reply