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

Error running Javascript to convert from PDF to XLSX

Community Beginner ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

While running the code: saveAs("C:\temp\temp.xlsx", "com.adobe.acrobat.xlsx") it will start converting before the error: "The specified file could not be written to. It may be in use" pops up and the conversion fails. So I decided to test that theory using the Windows utility File Locksmith, the only program accessing the PDF is Acrobat DC.

I also tested just converting through Export menu and it works just fine, this error only occurs when using JavaScript. How can I bypass this issue as I am looking to automate this process using VBA after confirming the javascript is working.

TOPICS
Edit and convert PDFs , General troubleshooting , JavaScript

Views

963

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
1 ACCEPTED SOLUTION
Community Beginner ,
Jan 15, 2024 Jan 15, 2024

Copy link to clipboard

Copied

LATEST

Found the solution.
Under Preferences -> Security (Enhanced) -> Disable Protected Mode at startup

After changing that setting and restarting the code was executing flawlessly.

View solution in original post

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 ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

The correct file-path syntax you need to use is this:

"/C/temp/temp.xlsx"

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 Beginner ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

Thanks for the fast response,

On a Windows system you would use a more Unix like path?
Testing with the path set as "/C/temp/temp.xlsx" still produces the same error unfortunately.

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 ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

It's the same path syntax for all platforms.

The code works fine for me. Do you actually have a folder called "temp" under the C drive? Because the script can't create it for you.

 

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 Beginner ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

I do, I have also tested other paths to see if it was a permissions issue.
I tried on my secondary drive with the path "/E/temp.xlsx" and "/E/project/temp.xslx" Still the same error message. I have now also tested on other work machines and the same issue persists so it's not an installation issue.

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 Beginner ,
Jan 15, 2024 Jan 15, 2024

Copy link to clipboard

Copied

LATEST

Found the solution.
Under Preferences -> Security (Enhanced) -> Disable Protected Mode at startup

After changing that setting and restarting the code was executing flawlessly.

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