简体   繁体   中英

How to detect if PDF is opened in chrome pdf viewer

I'm using a PDF form which submits data on a button click via Acrobat javascript similar to what written below.

this.submitForm({
    cURL: "http://www.example.com/cgi-bin/myscript.cgi#FDF",
    cSubmitAs: "FDF" // 
});

After downloading from the weblink, some users if using google chrome open the PDF in chrome's inbuilt PDF viewer, which does nothing at all when clicked on Submit Button.

Apart from waiting, when google will add form submission feature in it's PDF viewer, I need something so that on load of PDF, I can detect the viewer and tell users that this viewer is incapable of submitting forms, use Adobe reader to fill this form. So they won't spend minutes to fill the forms and lately find it not working.

Calling a script when PDF opens could be my next question.

Thanks

The built-in PDF viewer of Chrome does not understand Acrobat JavaScript (I am tempted to call it too dumb, but that would be not very fair).

It is as simple as that.

You might try to use the Submit Action instead of the JavaScript submit() method. There is a slim chance that this does work.

The other strategy to deal with too dumb PDF viewers is to set up the form for those viewers and then run a JavaScript when the document opens or in the PageOpen event of the page it open with which does activate the smart components of the form. In this script you would, for example hide the field stating that the PDF viewer used is too dumb, hiding some buttons, showing some other buttons, initializing specific initial states of the form etc.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM