1 Reply Latest reply on Sep 3, 2015 5:45 PM by Qwertyfly...

    How can i save pdf changes through Jsx  in illustrator?

    Upendra_sengar Level 2

      I stuck on saving PDF document to save changes, i don't know why illustrator is not supporting it for PDF, when i execute app.documents[0].save() , it creates an .ai file on the same path where  PDF resides. one method is known that is to saveAs document on the same path, but i guess there should be another method to save changes in pdf file . please let me know if possible.


      Thanks in advance.

        • 1. Re: How can i save pdf changes through Jsx  in illustrator?
          Qwertyfly... Level 4

          .ai is the native format and so the save function saves as ai.


          you need to do a saveas and replace the original.


          something like this will do what you want.

          see the javascript reference for more about the PDFSaveOptions.

          drop the function at the top (or bottom) of your script.

          then just call it when you need it using  saveFileToPDF(doc);


          this example saves the active document.

          to save document[0] or something, pass that to the function.





          function saveFileToPDF (doc) {
              if ( app.documents.length > 0 ) {
                  saveOpts = new PDFSaveOptions();
                  saveOpts.compatibility = PDFCompatibility.ACROBAT5;
                  saveOpts.generateThumbnails = true;
                  saveOpts.preserveEditability = true;
                  doc.saveAs(doc.fullName, saveOpts );
          var doc = app.activeDocument;
          saveFileToPDF (doc) ;