Article View: adobe.scripting.indesign
Article #1381Re: [CS3 JS] A little help setting flattener prefs
From: Rasmus_Olsen
Date: Thu, 12 Feb 2009 14:11
Date: Thu, 12 Feb 2009 14:11
46 lines
2493 bytes
2493 bytes
Referring to a flattener preset in either a PDF preset or app.pdfexportPreferences will do the job. I've wrote this function to create my flattener presets. Its based on the InDesign CS3 document preset sample script. If you replace the app.flattenerPresets array object with app.pdfexportPresets and replaces the preset attributes the function can be used to create PDF presets as well.
A big thanks to Thomas and BalοΏ½zs for the kick(s) in the right direction. ;-)
function createFlattenerPreset(myPresetName){
var myPreset = app.flattenerPresets.item(myPresetName);
try {
myPresetName = myPreset.name;
alert("Flattener preset found\nResetting preset attributes...");
with(myPreset){
rasterVectorBalance = 100;
lineArtAndTextResolution = 914; //Res12 output/2
gradientAndMeshResolution = 300;
convertAllTextToOutlines = false;
convertAllStrokesToOutlines = false;
clipComplexRegions = true;
}
}
catch(myError){
alert("Flattener preset not found\nCreating preset with attributes...");
myPreset = app.flattenerPresets.add(
{
name:myPresetName,
rasterVectorBalance:100,
lineArtAndTextResolution:914, //Res12 output/2
gradientAndMeshResolution:300,
convertAllTextToOutlines:false,
convertAllStrokesToOutlines:false,
clipComplexRegions:true
}
);
var presets = app.flattenerPresets;
for(var i = 0; i < presets.length; i++){
var ifFound;
if(presets.item(i).name == "myPreset"?ifFound = true:ifFound = false);
}
if(ifFound == true?alert("Preset succesfully created!"):alert("Houston we have a problem!"));
}
}
Regards,
Rasmus
Technical Details
Message-ID:
<59b7d6d2.4@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b7d6d2.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,2258a9bb02c0f511 X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII From: Rasmus_Olsen@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: [CS3 JS] A little help setting flattener prefs Message-ID: <59b7d6d2.4@webcrossing.la2eafNXanI> Date: Thu, 12 Feb 2009 06:11:53 -0800 References: <59b7d6d2.-1@webcrossing.la2eafNXanI> Lines: 69 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit