Avoid javascript  SOLVED

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

wings software
User
Posts: 18
Joined: Mon Apr 23, 2012 12:38 pm

Avoid javascript

Post by wings software »

Hi,

Is there a way to avoid embedded javascript to be executed when opening a pdf in the ActiveX Viewer? I did a test and I can automatically open a (potentially dangerous) web page using launchURL().
Since it is possible that my users open a pdf file that comes from an untrusted source (email) I want to avoid all automatically executed javascript.

Thanks,

Jan
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19864
Joined: Mon Jan 12, 2009 8:07 am

Re: Avoid javascript

Post by Stefan - PDF-XChange »

Hello Jan,

Disabling JavaScript in general could prevent some files from working properly, if they rely on some code for e.g. their form fields. A better approach would be to handle the events wherever a JS is executed.
I would recommend you to take a look here:
https://help.pdf-xchange.com/DEV/de ... c_js_event

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

Re: Avoid javascript

Post by Vasyl - PDF-XChange »

Hi Jan.
I want to avoid all automatically executed javascript.
You may disable JS-executing fully by:

Code: Select all

pdfCtl.SetProperty("JavaScript.Enable", "false");
pdfCtl.SetProperty("JavaScript.WarnOnExecute", "false");
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.
wings software
User
Posts: 18
Joined: Mon Apr 23, 2012 12:38 pm

Re: Avoid javascript

Post by wings software »

You may disable JS-executing fully by:
Thanks, works great.

Jan
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19864
Joined: Mon Jan 12, 2009 8:07 am

Re: Avoid javascript

Post by Stefan - PDF-XChange »

:)