Adobe 0046100128056 Scripting Guide - Page 145
Processing a Profile
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 145 highlights
CHAPTER 10: Working with Preflight Processing a Profile 145 //Requires the page size to be 8.5in x 11in (Letter Size) //enters a value for tolerance myRule.ruleDataObjects.add("tolerance", RuleDataType.realDataType, 0.01); //Sets the width to the point equivalent of 8.5 inches myRule.ruleDataObjects.add("width", RuleDataType.realDataType, 612); //Sets the width to the point equivalent of 11 inches myRule.ruleDataObjects.add("height", RuleDataType.realDataType, 792); //true = ignore orientation is checked myRule.ruleDataObjects.add("ignore_orientation", RuleDataType.booleanDataType, true); 3. Set the rule's reporting state. This is done using the rule's flag property. There are several choices (disabled, information, warning, and error), controlled by the PreflightRuleFlag enumeration. //set the rule to return an error myRule.flag = PreflightRuleFlag.returnAsError; Processing a Profile In the desktop version of InDesign, preflight errors are reported in the user interface. In scripting (especially for InDesign Server), the errors are generated on demand. The following script processes an InDesign document. (For the complete script, see ProcessPreflightProfile.) If there are errors, it writes the results to a new PDF file. For an example of the output, see the figure below the script. // Assume there is a document. var myDoc = app.documents.item(0); // Assume the Test preflight profile exists. var myProfile = app.preflightProfiles.itemByName("Test"); //Process the myDoc with the rule var myProcess = app.preflightProcesses.add(myDoc, myProfile); myProcess.waitForProcess(); var myResults = myProcess.processResults; //If errors were found if (myResults != "None") { //Export the file to PDF. The "true" value selects to open the file after export. myProcess.saveReport(File("C:\PreflightResults.pdf"), true); } //Cleanup myProcess.remove();