Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 77806

Odd Script Issue - Export to Pdf

$
0
0

Hi All.

 

I have a very small page with three text boxes.

I have a number of small incopy text files I am flowing in.

I am using the attached script to export as a pdf.

The script takes the content of the 1, 2, and 3 text box on each page and creates a file name.

The export works beautifully, EXCEPT for one very annoying little thing.

The page that contains the first line of every incopy file is not utilizing the script correctly.

 

ex.

correct on almost every export = filename-[0]-[2]-[1].pdf

the page that contains the first line of each place file= filename-[1]-[2]-[0].pdf and it is ignoring all the replace rules.

 

Any ideas? This is so random I cannot figure out the issue.

 

main ();

function main() {

var curDoc = app.activeDocument;


// loop through all pages
for ( var i = 0; i < curDoc.pages.length; i++ ) {    // the current page    var curPage = curDoc.pages[i];


// Page number
    var pName = curPage.name;    // controls the loop    var controller = true;    // all paragraphs on the current page

var allPages = (curPage.textFrames[1]); {
    var paraName = allPages.contents;


var paraString = "-" + paraName.replace( /\s+$/ , "" ).replace( /\s+/g , "-" ).toLowerCase().replace(/\+/, '').replace(/,/g, '');


}


var allPages2 = (curPage.textFrames[2]); {
    var paraName2 = allPages2.contents;


var paraString2 = "-" + paraName2.replace( /\s+$/ , "" ).replace( /\s+/g , "-" ).toLowerCase().replace(/\+/, '').replace(/,/g, '');


}


var allPages3 = (curPage.textFrames[0]); {
    var paraName3 = allPages3.contents;


var paraString3 = "-" + paraName3.replace( /\s+/g , "-" ).toLowerCase().replace(/-/g, '');


}

var folderPath = "~/-create/Process/Labels" ;
   {        var appendix = paraString;    }      var filePath = folderPath + "/" + curDoc.name.replace(/\.indd$/,"") + paraString3 + paraString2 + paraString + ".pdf";    var myFile = File( filePath );    var pdfPreset = "JOYS Labels";


with (app.pdfExportPreferences) {
  pageRange = curPage.name;   viewPDF = false }  curDoc.exportFile( ExportFormat.PDF_TYPE, myFile, false, pdfPreset );  } // end for > pages


} // end for > main

Viewing all articles
Browse latest Browse all 77806

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>