Quantcast
Channel: Adobe Community : Discussion List - Illustrator Scripting
Viewing all articles
Browse latest Browse all 3671

Script - save as pdf causing pdf to print as grayscale

$
0
0

Could someone help explain why this code is causing this problem?  The document that the user is getting should print in color, but no go.

here is the code I'm using:

 

//          Set your password here 
var pass = ****][;.'; 
// 
//--------------------------------------------------- 
if ( app.documents.length > 0 ) {       //make sure we have a file open to work with     var doc = app.activeDocument;     if ( doc.fullName.toString().substr(doc.fullName.toString().lastIndexOf('.')) == ".ai" ){       //Make sure you are working with an ai file         var myFile = new File(doc.fullName.toString().substr(0,doc.fullName.toString().lastIndexOf('.')) + ".pdf");         var saveOpts;         setSaveOptions();         saveFileToPDF(myFile);     }else{alert("Active Document is not an '.ai' file")} 
}else{alert("No Document Open")}   
function saveFileToPDF(myFile){     var originalInteractionLevel = userInteractionLevel;        //save the current user interaction level     //userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;      //Set user interaction level to suppress alerts     userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;      //Set user interaction level to suppress alerts     doc.saveAs(myFile,saveOpts);        //Save File     userInteractionLevel = originalInteractionLevel;        //Set user interaction level back to original settings 
}   
function setSaveOptions(){     //  Setup Save Options     saveOpts = new PDFSaveOptions();       saveOpts.compatibility = PDFCompatibility.ACROBAT8;       saveOpts.generateThumbnails = true;       saveOpts.optimization = true;       saveOpts.preserveEditability = false;       //saveOpts.bleedOffsetRect = [2,2,2,2];       //saveOpts.trimMarks = true;       //=======================  COMPRESSION ===========================       saveOpts.colorCompression = CompressionQuality.AUTOMATICJPEGLOW;       saveOpts.colorDownsamplingMethod = DownsampleMethod.BICUBICDOWNSAMPLE;       saveOpts.colorDownsampling = 50;       saveOpts.colorDownsamplingImageThreshold = 300;       //-----------------------------------------------------------------------------------------------------------       saveOpts.grayscaleCompression = CompressionQuality.AUTOMATICJPEGLOW;       saveOpts.grayscaleDownsamplingMethod = DownsampleMethod.BICUBICDOWNSAMPLE;       saveOpts.grayscaleDownsampling = 50;       saveOpts.grayscaleDownsamplingImageThreshold = 300;       //-----------------------------------------------------------------------------------------------------------       saveOpts.monochromeCompression = MonochromeCompression.CCIT4;       saveOpts.monochromeDownsamplingMethod = DownsampleMethod.BICUBICDOWNSAMPLE;       saveOpts.monochromeDownsampling = 50;       saveOpts.monochromeDownsamplingImageThreshold = 300;       //====================  END OF COMPRESSION =======================       //saveOpts.colorConversionID = ColorConversion.COLORCONVERSIONREPURPOSE;       //saveOpts.colorDestinationID = ColorDestination.COLORDESTINATIONWORKINGCMYK;       ///       saveOpts.requirePermissionPassword = true;       saveOpts.permissionPassword = pass;       saveOpts.pDFAllowPrinting = PDFPrintAllowedEnum.PRINT128LOWRESOLUTION;   
}

Viewing all articles
Browse latest Browse all 3671

Trending Articles



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