Skip to main content
Participant
March 17, 2021
Question

Anti Virus sees my javascript as a Virus

  • March 17, 2021
  • 4 replies
  • 849 views

Hi Guys,

 

I've created a pdf with the following javascript:

/* Remove all Buttons */

// iterate over all fields
for (i = 0; i < this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));

this.removeField("Reset");
this.removeField("Save as");
this.removeField("Print");


this.flattenPages();
app.execMenuItem("SaveAs");
{
}
}

 

The script is working fine, the only problem is that other users cannot get this to work due to there Anti Virus software. It will delete the script as a safety precaution.

Is there another way to have the same result but without using the script?

 

This topic has been closed for replies.

4 replies

Legend
March 17, 2021

Without using a script you could hide certain buttons. But you need a script to flatten.

Antivirus engines are likely to block anything with any JavaScript at all.

try67
Community Expert
Community Expert
March 17, 2021

I doubt it has anything to do with how your code works. It's more likely an issue it has with embedded code in general, but you can test it by removing one line at a time and seeing if it still reports it as a virus. Either way, the solution needs to be to report this issue to the makes of the AV software and ask them to fix it.

JR Boulay
Community Expert
Community Expert
March 17, 2021

Moreover, it is not impossible that the anti-virus detects your script as malicious simply because it contains unnecessary and incomprehensible code…

Acrobate du PDF, InDesigner et Photoshopographe
Participant
March 17, 2021

Thank you for the feedback!

JR Boulay
Community Expert
Community Expert
March 17, 2021

No.

In any case the loop is useless, you should just use:

 

this.removeField("Reset");
this.removeField("Save as");
this.removeField("Print");

this.flattenPages();
app.execMenuItem("SaveAs");

 

Beware that flattenPages() will not work in Acrobat Reader.

Acrobate du PDF, InDesigner et Photoshopographe