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

278

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

Most Valuable Participant , 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 goneI assume this is called from or part of a trusted function.

Likes

Translate

Translate
Most Valuable Participant ,
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