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

Script to outline text when open pdf

Participant ,
Apr 07, 2024 Apr 07, 2024

use AI to directly open pdf , if some computer missing font, so these character will show error glyph.  

how to write a correct script , the highlight is selected? thanks

 

ruihuang_0-1712547833248.pngexpand image

 

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pageRangeToOpen = "all"; 
pdfOptions.placeAsLinks = false;

 

//how to add outline action in here?


var idoc = app.open(File(path)); // full path to your pdf
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;

 

TOPICS
Scripting
458
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

Community Expert , Apr 08, 2024 Apr 08, 2024

Hi @rui huang, I think you might be able to do what you ask in Acrobat. I don't know of any way to do it in Illustrator for the reason Carlos gave—Illustrator has no power to alter a pdf without first instantiating DOM objects, eg. TextFrames, and by that time, the opportunity is gone. I'd be surprised, however, if Acrobat couldn't do it. I did a quick search and this answer by Scott mentions a way to do it in Acrobat.

- Mark

Translate
Adobe
Community Expert ,
Apr 07, 2024 Apr 07, 2024

Flattern Transparency is not part of OpenOptionsPDF, you have to open the pdf then apply Flattening after the pdf opens

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 07, 2024 Apr 07, 2024

Hi Carlos, 

After opening the PDF document, then outline text, it is meaningless , because the fonts are missing.
function outlineText() {
while (app.activeDocument.textFrames.length > 0) {
app.activeDocument.textFrames[0].createOutline();
}
}

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 08, 2024 Apr 08, 2024

Hi @rui huang, I think you might be able to do what you ask in Acrobat. I don't know of any way to do it in Illustrator for the reason Carlos gave—Illustrator has no power to alter a pdf without first instantiating DOM objects, eg. TextFrames, and by that time, the opportunity is gone. I'd be surprised, however, if Acrobat couldn't do it. I did a quick search and this answer by Scott mentions a way to do it in Acrobat.

- Mark

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 08, 2024 Apr 08, 2024

also, opening the pdf as Links will preserve the fonts, at that point you might be able to flatten the file

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 15, 2024 Apr 15, 2024
LATEST

Hi Carlos, 

I see you reply in other post,  said that can use app.executeMenuCommand('Flatten Transparency'), but it will pop up a window to prompt. the action is not good for user.

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