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

script to Flatten Transparency

Participant ,
Apr 29, 2024 Apr 29, 2024

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
990
Translate
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 =

...
Translate
Adobe
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 = doc.placedItems;
for(var i=pItems.length-1; i>=0; i--){
pItems[i].selected = true;
app.executeMenuCommand('Flatten Transparency') ;
}

app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;

Translate
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

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

Translate
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

Untested, but should be possible:

In your Script

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

 

Sent from my phone

Translate
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

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

Translate
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

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.

Translate
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

@cariley09 

who did you actually answer?

Translate
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
LATEST

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

Translate
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