1 Reply Latest reply: Apr 2, 2012 2:26 AM by Muppet Mark RSS

    Saving PDF in Photoshop with Security Options

    apmaui808 Community Member

      How can I access the PDF Security Options in saving a PSD or JPG file to a PDF file? What I need is to set a fixed password for all the files I save as PDF. I want to restrict the Permissions to printing only. All other options (like modifying the file or extracting images) are not allowed.


      I have a sample script to save an opened file as a PDF, saving it to a PDFs sub-folder. But I don't know how to preset the Security options. How can this be scripted? Here it is:


      // Defines the active document that is opened

      var docRef = app.activeDocument;
      var imgName= docRef.name;
      imgName = imgName.substr(0, imgName.length -4);


      // Get name of Folder Path
      var docFolder = docRef.fullName.parent;
      var folderPath = docFolder.fsName;


      // Create a sub-folder called PDFs in the working folder
      var newPathFolder = new Folder( folderPath + "//PDFs/");


      // Flatten layers before saving


      // Save Options for PDFs

      pdfFile = new File( folderPath + "//PDFs/" + imgName + ".pdf")
      pdfSaveOptions = new PDFSaveOptions()
      pdfSaveOptions.PDFCompatibility = PDFCompatibility.PDF16;
      pdfSaveOptions.colorConversion = false;
      pdfSaveOptions.destinationProfile = "U.S. Web Coated (SWOP) v2";
      pdfSaveOptions.embedColorProfile = false;
      pdfSaveOptions.optimizeForWeb = true;
      pdfSaveOptions.profileInclusionPolicy = false;
      pdfSaveOptions.encoding = PDFEncoding.JPEG;
      pdfSaveOptions.downSample = PDFResample.PDFBICUBIC;


      // set to NONE to allow PDF Security Options. Permission is for Printing only. A common password
      // needs to be added as soon as the file is saved without typing it in all the time
      pdfSaveOptions.PDFStandard = PDFStandard.NONE;


      pdfSaveOptions.downSampleSize = 200;
      pdfSaveOptions.downSampleSizeLimit = 250;
      pdfSaveOptions.layers = false;
      pdfSaveOptions.jpegQuality = 4;

      docRef.saveAs(pdfFile, pdfSaveOptions, true, Extension.LOWERCASE);


      The forum does not seem to have any discussion on this. I hope somebody can share their knowledge about this.


      Thanks ;-)

        • 1. Re: Saving PDF in Photoshop with Security Options
          Muppet Mark Community Member

          There are no properties available to do this using the regular DOM… Photoshops PDF is quite limited compaired to some other apps… That a side in most apps I would make use of a named preset and just call that… I haven't tested in Photoshop but if it works it may be the only way to do this…


          pdfSaveOptions.presetFile = 'somePreset';