PSD to PDF

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

newuser666

PSD to PDF

Post by newuser666 »

Hi

I am converting a PSD to PDF. The PSD has a text layer. When i convert it to PDF the text layer doesnt remain as a separate Object but gets rasterized. Can some one let me know how to achieve this so that the text layer remains as a separate layer/object.


Code is as below:


Code: Select all
      var albumHeight ="+str(imageHeight.Val)+";
      var albumWidth ="+str(imageWidth.Val)+";
     
      var tempDoc;
      var pasteDoc = documents.add("+str(imageWidth.Val)+","+str(imageHeight.Val)+","+str(250)+", ""PDF"",NewDocumentMode.RGB, DocumentFill.WHITE);
      tempDoc = pasteDoc;
     
      var fileRef = new File("""+Path+""");
      open (fileRef);
      fileRef = null;
      var srcDoc = activeDocument;
      var docRes = srcDoc.resolution;
      srcDoc.flatten();

      var srcDocWidth = "+str(imageWidth.Val)+";
      var srcDocHeight ="+str(imageHeight.Val)+";
      var srcDocLeft =0;
      var srcDocTop =0;
      var y1 = srcDocTop;
      var y2 = srcDocTop+srcDocHeight;
      var x1 = srcDocLeft;
      var x2 = srcDocLeft+srcDocWidth;
      var positionArray = [[x1,y1],[x2,y1],[x2,y2],[x1,y2]];
      var highResImageW = "+str(imageWidth.Val)+";
      var highResImageH = "+str(imageHeight.Val)+";
      var cropWidth = highResImageW;
      var cropHeight = highResImageH;
      var cropLeft = 0;
      var cropTop = 0;
      var cropArray = [[cropLeft,cropTop],[cropLeft+cropWidth,cropTop],[cropLeft+cropWidth,cropTop+cropHeight],[cropLeft,cropTop+cropHeight]];
     
      srcDoc.selection.select(cropArray,SelectionType.REPLACE,0,false);
      srcDoc.selection.copy();
      activeDocument = tempDoc;
      var tempoArray1 = [[x1,y1],[x2,y1],[x2,y2],[x1,y2]];
      tempDoc.selection.select(tempoArray1,SelectionType.REPLACE,0,false);
      var newLayerRef = tempDoc.paste();
     
      newLayerRef.opacity =  100;
      newLayerRef.name = srcDoc.name;
      srcDoc.close(SaveOptions.DONOTSAVECHANGES);
      srcDoc = null;
      srcDocWidth = null;
      srcDocHeight = null;
      srcDocLeft = null;
      srcDocTop = null;
      tempoArray1 = null;
      newLayerRef = null;
      apertureRotation = null;
     
     
      theSaveOptions = new PDFSaveOptions();
      theSaveOptions.alphaChannels = true;
      theSaveOptions.annotations = true;
      theSaveOptions.embedColorProfile = true;
      theSaveOptions.layers = true;
      theSaveOptions.spotColors = true;
     
      myFile = new File("""+savePath+".pdf"+""");
     
      var finalDoc;
      activeDocument = pasteDoc;
     
      JavaScript = JavaScript+"finalDoc = pasteDoc;
     
      activeDocument = pasteDoc;
     

     
             
        pasteDoc.convertProfile(""QBY_Satin"", Intent.PERCEPTUAL, true, false);
   
       
   
     
      pasteDoc.saveAs(myFile, theSaveOptions, true, Extension.LOWERCASE);
      pasteDoc.close(SaveOptions.DONOTSAVECHANGES);
      pasteDoc = null;
     
      srcDoc = null;
     

 
  if (defaultRulerUnits != preferences.rulerUnits)
  {
  preferences.rulerUnits = defaultRulerUnits;
  }