Remove ALL the Javascript in the PDF documents

Hi team,
Any update on this issue.

@arun762050

The issue has recently been logged in our issue management system and is pending for investigation. We will surely investigate and resolve it on first come first serve basis and let you know as soon as we have some definite updates regarding its resolution. Please have patience and give us some time.

We apologize for the inconvenience.

@arun762050

Scripts were not stripped from the file because the file contains a dynamic XFA form, and scripts were contained in the form and not in the document itself.

Therefore in order to remove JavaScript from the document you should first convert an XFA form into a plain AcroForm:

string pdf_path = dataDir + "purchase_order.pdf";
string temp_path = dataDir + "purchase_order_acroform.pdf";
using (Document document = new Document(pdf_path))
{
    // Convert an XFA form into a plain AcroForm
    document.Form.Type = FormType.Standard;
    document.Save(temp_path);
}

// load frm temp file and remove js using javascriptstripper
PdfJavaScriptStripper pdfJsStripper = new PdfJavaScriptStripper();
pdfJsStripper.Strip(temp_path, dataDir + "purchase_order_out.pdf");

This code snippet should be used with Aspose.Pdf v.23.10 and later, as this version will contain additional fixes related to XFA form conversion.

Also, please note that PdfJavaScriptStripper does not remove buttons from the document or make them non-clickable. It just removes all scripts associated with these buttons. If you need to make the document non-interactive (so that the buttons will be non-clickable pictures, and form fields will be made inaccessible to fill), the flatten procedure should be used, e.g. via the Form facade.

The issues you have found earlier (filed as PDFNET-48974) have been fixed in this update.