3 Replies Latest reply on Nov 26, 2008 9:18 AM by (Molly_Hardin)

    [JS, CS3] Change text color and export pdfs

      Hi there,
      I am new to scripting and I am trying to find out if a script exists that will export a PDF, then change all text of a certain color to black, then export another pdf with the same settings as the first, but appending the filename. I've searched the forum and understand about the change color bug, but I haven't seen anything in JavaScript -- It's all been applescript.

      Anyone have any brilliant ideas?
      Help is GREATLY appreciated!
        • 1. Re: [JS, CS3] Change text color and export pdfs
          Level 1
          Can anyone help me??? I am desperate!
          • 2. Re: [JS, CS3] Change text color and export pdfs
            Loic.Aigon Adobe Community Professional
            I couldn't get the specific color replacement, I chose the rambo approach...<br /><br />if(app.documents.length!=0)<br />{<br />     var doc = app.activeDocument;<br />     if(doc.saved==true)<br />     {<br />          var docFile = doc.fullName;<br />          var docFile = doc.fullName;<br />          var myFile = File(docFile).fsName;<br />          var myPdfPreset = app.pdfExportPresets.item("[PDF/X-1a:2001]"); //Put what you want <br />          var myPdfFile = new File(String(myFile).split(".indd")[0]+".pdf");<br />          exportPDF(myPdfFile,myPdfPreset);<br />          var myTfs = doc.textFrames.everyItem().getElements();<br />          for(i=0; i<myTfs.length; i++)<br />          {<br />               //will reset all texts to black, quite drastic but works.<br />               myTfs[i].texts[0].fillColor = doc.swatches[2]; <br />               //Should be better to use swatches.item("[Black]"); <br />               //But can't check on my french system<br />          }<br />          var myPdfFile = new File(String(myFile).split(".indd")[0]+"_AllTextsToBlack.pdf");<br />          exportPDF(myPdfFile,myPdfPreset);<br />     }<br />     else<br />     {<br />          alert("Please save your document first");<br />     }     <br />}<br />else<br />{<br />     alert("You need to open a doument first !");exportF<br />}<br /><br />function exportPDF(myPdfFile,myPdfPreset)<br />{<br />     doc.exportFile (ExportFormat.PDF_TYPE, myPdfFile, false, myPdfPreset, undefined, undefined, false);<br />}
            • 3. Re: [JS, CS3] Change text color and export pdfs
              Level 1
              Oh thank you! I will give this a shot! Thanks so much!