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

script to Flatten Transparency

Participant ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

Hello, Proficient Expert,

 

I build a new post to discussthis issue about Flatten Transparency,  Is there a better way to solve it with AI,  besides using app.executeMenuCommand('Flatten Transparency')?

 

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageRangeToOpen = "all"; 
pdfOptions.placeAsLinks = true;
var idoc = app.open(File("~/Desktop/test.pdf")); 
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;var doc = app.activeDocument;
var pItems = doc.placedItems;
for(var i=pItems.length-1; i>=0; i--){ 
pItems[i].selected = true;
app.executeMenuCommand('Flatten Transparency') ;
}

TOPICS
Scripting

Views

211

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

correct answers 1 Correct answer

Participant , Apr 29, 2024 Apr 29, 2024

below script without pop up a window, have to basic on the preset in the window of 'Flatten Transparency'. if the preset is change , all will be changed, there is risk to proceed pdf file.  whether can make the preset with script ?


app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageRangeToOpen = "all";
pdfOptions.placeAsLinks = true;
var idoc = app.open(File("~/Desktop/test.pdf"));

var doc = app.activeDocument;
var pItems =

...

Votes

Translate

Translate
Adobe
Participant ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

below script without pop up a window, have to basic on the preset in the window of 'Flatten Transparency'. if the preset is change , all will be changed, there is risk to proceed pdf file.  whether can make the preset with script ?


app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageRangeToOpen = "all";
pdfOptions.placeAsLinks = true;
var idoc = app.open(File("~/Desktop/test.pdf"));

var doc = app.activeDocument;
var pItems = doc.placedItems;
for(var i=pItems.length-1; i>=0; i--){
pItems[i].selected = true;
app.executeMenuCommand('Flatten Transparency') ;
}

app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;

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
Participant ,
Apr 30, 2024 Apr 30, 2024

Copy link to clipboard

Copied

I had also asked for help to create a script that imported PDF files into multiple artboards, and then applied a transparency conversion with a preset profile. But no one helped me. Probably no one knows how to do it.

https://community.adobe.com/t5/illustrator-discussions/script-help-import-file-to-artboards-and-flat...

 

 

1.jpg

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
Community Expert ,
Apr 30, 2024 Apr 30, 2024

Copy link to clipboard

Copied

Untested, but should be possible:

In your Script

Save as PDF with PDFSaveOptions flattenerPreset: string (the name of your preset)

 

Sent from my phone

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
Participant ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

must convert text to outline when open,  because pdf file may be missing font , so will show error char.

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
Community Beginner ,
Apr 30, 2024 Apr 30, 2024

Copy link to clipboard

Copied

I think you know that it carries the risk of preset changes affecting all documents and as currently there's no direct script to set the preset for Flatten Transparency....... you can mitigate risks by specifying the transparency flattening settings programmatically within your script.

 

It involves simple things like you've to define the necessary parameters such as raster resolution and color conversion options to match your desired preset. By setting these parameters in your script, you ensure consistent and controlled flattening without relying on manual presets. You can also explore Adobe's scripting documentation for any updates or alternative approaches to achieve this task more effectively.

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
Community Expert ,
Apr 30, 2024 Apr 30, 2024

Copy link to clipboard

Copied

@cariley09 

who did you actually answer?

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
Participant ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

LATEST

because PC may be missing font, must convert all text to outline when open, how to preset this ?

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