• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[CS3 JS] A little help setting flattener prefs

New Here ,
Feb 10, 2009 Feb 10, 2009

Copy link to clipboard

Copied

Ladies and gentlemen,

A little help setting flattener preferences when exporting is needed. I can't seem to grasp why I can use with(app.colorSettings){ to set the properties of the ColorSetting object but with(app.flattenerPreferences){ ESTK gives me "Object does not support the property or method.."

I'm requesting a little kick in the right direction, thanks :-)

Best regards,
Rasmus
TOPICS
Scripting

Views

897

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 10, 2009 Feb 10, 2009

Copy link to clipboard

Copied

Hi Rasmsus / Hej Rasmus

with(app.flattenerPresets) {
alert(item(0).name);
}

This will alert the name of the first flattenerPreset.
app.flattenerPresets holds the defined presets and is read only.

The properties you can set, is listed here: http://www.indesignscriptingreference.com/CS3/JavaScript/FlattenerPreset.htm

So:
with(app.flattenerPresets) {
item(0).rasterVectorBalance = 100;
}

Should set the rasterVectorBalance to 100 for the first flattenerPreset (If the first preset is a Adobe preset [low resolution] you can only change it with scripting it seems)

Hope this helps (DK: Du er velkommen til at sende mig en mail på mail (at) nobrainer (dot) dk hvis du har brug for hjælp til andet.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 11, 2009 Feb 11, 2009

Copy link to clipboard

Copied

Hi Thomas,

Thank you for taking time to help me with this :-)

Setting the properties of the app.flattenerPresets.item(0) object does just that; you changes the properties of the "[Low Resolution]" flattener preset. What I need to know is: How do I instruct InDesign to use "x" flattener preset or flattener preferences when exporting a PDF?

In addition to this: When scanning through the InDesign object model viewer I can't help noticing the FlattenerPreference object. In my export script I set various properties of the ColorSetting object with(app.colorSettings){ - trying the same approach with(app.flattenerPreferences){ gives me the exception: "Object does not support the property or method FlattenerPreference" - so how do I set the properties of this object?

I hope that you understand my question(s) :-)

BTW I test the flattener preferences in effect upon export by using a filled frame with the Bevel and Emboss effect applied. The effect will get rasterized by the flattener when exporting a PDF version 1.3 from the document. Using Acrobat preflight on the resulting PDF I'm able to scan for image resolution and check whether or not the specific flattener property 'lineArtAndTextResolution = 300' was honoured. So far InDesign have been using 'lineArtAndTextResolution = 150' - this is a property of the Medium Resolution flattener preset. Sigh..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 11, 2009 Feb 11, 2009

Copy link to clipboard

Copied

Hi!

First, the reason why you cannot use with(app.flattenerPreferences) is just as the exception says: app doesn't have flattenerPreferences property... only spreads have such...
So I think the way you should go:

-create either manually or by script a flattenerPreset (app.flattenerPresets) and set the lineArtAndTextResolution to a value you need

-then create a PDFExportPreset (app.pdfExportPresets) where you set its appliedFlattenerPreset property to the desired preset

-then use document.exportFile(format, to, showingOptions, using) where you set the using parameter to the previously created PDFExportPreset.

Hope it helped!
Balázs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 11, 2009 Feb 11, 2009

Copy link to clipboard

Copied

Hi Balázs,

> appliedFlattenerPreset

This must be it! 😉 Will give it a shot - thanks man..

Regards,
Rasmus

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2009 Feb 12, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2009 Feb 12, 2009

Copy link to clipboard

Copied

Believe I've found a bug:
> clipComplexRegions:true

When visually inspecting the flattener preset the value of this variable is beeing reported as N/A. This same goes for false as well. Hmm.

Regards,
Rasmus

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 12, 2009 Feb 12, 2009

Copy link to clipboard

Copied

Hi Rasmus,

When rasterVectorBalance = 100, clipComplexRegions is not available.

Thanks,

Ole

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 12, 2009 Feb 12, 2009

Copy link to clipboard

Copied

LATEST
Hi Ole,

After consulting the "Transparency in Adobe Applications Print Production Guide" this makes perfectly sense. Thank you for correcting me.

Cheers!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines