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

How to convert a jpg to PDF

New Here ,
Feb 11, 2019 Feb 11, 2019

Copy link to clipboard

Copied

I am currently trying to convert a jpg image into a pdf with the following code:

function JpgToPdf (doc, img)

{

     var myDoc = app.newDoc();

     // myDoc.Open("/C/Users/tmuñoz/Desktop/Thuban-Nivel 2.pdf");

     myDoc.disclosed = true;

     doc.disclosed = true;

     newDoc = app.openDoc({

          oDoc: doc,

          cPath: img,

          bUseConv: true

     })

     newDoc.disclosed = true;

     var filePath = "/C/Users/tmuñoz/Desktop/Adobe/temp.pdf";

     //MySaveAs(newDoc,"/C/Users/tmuñoz/Desktop/Adobe","Thomas23.pdf");

     newDoc.saveAs({

             cPath:"/C/Users/tmuñoz/Desktop/Adobe/temp.pdf"

         })

newDoc.closeDoc(true);

}

The following code is not working and it sends me the following error:

RaiseError: The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder.

TOPICS
Acrobat SDK and JavaScript

Views

346

Likes

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

correct answers 1 Correct answer

LEGEND , Feb 11, 2019 Feb 11, 2019

Some ideas to try:

- try saving to a folder with only Latin1 characters (no ñ)

- quit Acrobat, restart and run the code once

- if the file exists delete it and check it has gone

I assume this is called from or part of a trusted function.

Likes

Translate

Translate
LEGEND ,
Feb 11, 2019 Feb 11, 2019

Copy link to clipboard

Copied

LATEST

Some ideas to try:

- try saving to a folder with only Latin1 characters (no ñ)

- quit Acrobat, restart and run the code once

- if the file exists delete it and check it has gone

I assume this is called from or part of a trusted function.

Likes

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