Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: Master Pages - PDF

$
0
0

Very good! I suggest one note, one change, and one improvement:

 

1. The masterPageName needs to be "Prefix-Name", including a dash between the two. The Prefix and Name are those as found in the Master Options dialog.

 

2. 'myPageName.name' will fail if "[None]" was applied (it has 'no' name). So first check if there *is* a master applied, and only if so, check its name.

 

3. The page number string can easily be fed into the PDF Export dialog. If you run this script and then call up "Export PDF", you will see the page range contains the correct page numbers.

 

var myDoc = app.activeDocument;
var myPages = myDoc.pages;
var pageLength = myPages.length;
var masterPageName = "Ch1-Master";
var myPageName, pageNoList = [];for (var p=0; p<pageLength; p++){
myPageName = myPages[p].appliedMaster;if (myPageName){  myPageName = myPageName.name;  if (myPageName == masterPageName)  {   pageNoList.push(myPages[p].name);  }}}
alert("Total Number of Pages : "+pageNoList.length+ "\r"+"Page No. List: "+pageNoList.join(", "));
app.pdfExportPreferences.pageRange = pageNoList.join(",");

Viewing all articles
Browse latest Browse all 37788

Trending Articles



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