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

    Saving PDF in Photoshop with Security Options

    apmaui808 Level 1

      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/");
      newPathFolder.create();

       

      // Flatten layers before saving
      docRef.flatten();

       

      // 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.preserveEditing=false;
      pdfSaveOptions.jpegQuality = 4;

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

       

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

       

      Thanks ;-)