• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Anti Virus sees my javascript as a Virus

New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

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?

 

TOPICS
Create PDFs , Edit and convert PDFs , JavaScript , PDF forms

Views

450

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Thank you for the feedback!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines