Skip to main content
Participant
January 10, 2025
Question

After an unrequested update I get an error attempting to write to a file error

  • January 10, 2025
  • 1 reply
  • 313 views

Hi

 

Hope you are well

 

 

I was wondering if you can help me.

 

I have a Javascript, that provides a button, that when clicked, converts the open file to a jpg file and stores it in a folder

 

This was working perfectly but there seems to have been an update/change and it no longer works

 

I have checked all security settings and added the path for the storage

 

I am on a windows 10 machine, my adobe is set to not update, I discovered the layout was different and then was an option saying about not using this version which I clicked but it still doesn’t work

 

Can you advise

 

 

 

 

 

 

 

// Define the trusted function

var myTrustedFunctions = app.trustedFunction(function() {

    app.beginPriv();

    try {

        var savePath = "C:\\Users\\david\\Desktop\\Attachments\\FUW\\renewal.jpg";

        this.saveAs({

            cPath: savePath,

            bPromptToOverwrite: false,

            cConvID: "com.adobe.acrobat.jpeg"

        });

        app.alert("Document exported successfully to " + savePath);

    } catch (e) {

        app.alert("Error exporting document: " + e.message);

    }

    app.endPriv();

});

 

// Add a tool button to execute the trusted function

app.addToolButton({

    cName: "Renewal",

    cLabel: "Renewal",

    cTooltext: "Renewal",

    cExec: "myTrustedFunctions()",

    cEnable: "event.rc = (event.target != null);"

});

 

 

 

Best wishes

 

 

David 

 

 

1 reply

PDF Automation Station
Community Expert
Community Expert
January 10, 2025

Enable protected mode at startup prevents writing to a directory.  Uncheck the box and restart Acrobat.

AtomizerAuthor
Participant
January 10, 2025

Hi Thank you so much for your help, works now, greatly appreciated 

AnandSri
Legend
January 21, 2025

Hi,

 

I hope you're doing well. Apologies for the delayed response and trouble.

 

We're glad to hear the issue has been resolved! If you need any further assistance, please don’t hesitate to reach out.

 

For future reference, you can explore this Adobe article for more details: Protected Mode Troubleshooting in Acrobat Reader.

 

Thanks,
Anand Sri.