Copy link to clipboard
Copied
Hi all,
I was wondering if someone could please help me and see if this is possible. I have limited knowledge of scripts and need some help. I have to export several Ai files to pdf daily at my work, and save as a "LowRes" Adobe PDF preset, and add "_LowRes" to the pdf name. Then export again with "HiRes" Adobe PDF preset (mostly adding trim marks/bleed), and add "_HiRes" to the pdf name. Right now, its all manual work to do that for each AI files.
Is it possible with a script to do this:
I don't have "LowRes" and "HiRes" PDF presets, so I've used "High Quality Print" and "Smallest File Size".
var files = File.openDialog("Select files", "*.ai", true);
for (var i = 0; i < files.length; i++) {
app.open(files[i]);
var file1 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.pdf");
var file2 = new File(String(files[i].fullName).slice(0, -3) + "_LowRes.pdf");
var PDF1 = new PDFSaveOptions();
var PDF2 = new PDFSaveOptions();
PDF1.pDFPreset = "[High Qua
...
Copy link to clipboard
Copied
Which version of Illustrator are you using?
Copy link to clipboard
Copied
Hi Kurt,
I'm using Illustrator 2022 CC.
Copy link to clipboard
Copied
I don't have "LowRes" and "HiRes" PDF presets, so I've used "High Quality Print" and "Smallest File Size".
var files = File.openDialog("Select files", "*.ai", true);
for (var i = 0; i < files.length; i++) {
app.open(files[i]);
var file1 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.pdf");
var file2 = new File(String(files[i].fullName).slice(0, -3) + "_LowRes.pdf");
var PDF1 = new PDFSaveOptions();
var PDF2 = new PDFSaveOptions();
PDF1.pDFPreset = "[High Quality Print]";
PDF2.pDFPreset = "[Smallest File Size]";
app.activeDocument.saveAs(file1, PDF1);
app.activeDocument.saveAs(file2, PDF2);
app.activeDocument.close();
}
Copy link to clipboard
Copied
Thank you so much!! This worked like a charm:) I was able to swap out the naming of the presets. You made my day!
Copy link to clipboard
Copied
Wow, thank you for sharing that, femkeblanco!
This has literally cut the time i spent exporting PDFs on a project from 2 hours to 2 minutes.
I should have looked into scripting this process ages ago!
Copy link to clipboard
Copied
Is it possible to create your own pdf preset, and replace it in this script, I've tried several homemade pdf presets so far I can't get it to work by subbing in the name of my new preset, made sure the preset is in /Library/Application Support/Adobe/Adobe PDF/ etc.
keeps failing at the line: app.activeDocument.saveAs(file1, PDF1);
This is what I have:
var files = File.openDialog("Select files", "*.ai", true);
for (var i = 0; i < files.length; i++) {
app.open(files[i]);
var file1 = new File(String(files[i].fullName).slice(0, -3) + "_HR.pdf");
var file2 = new File(String(files[i].fullName).slice(0, -3) + "_LowRes.pdf");
var PDF1 = new PDFSaveOptions();
var PDF2 = new PDFSaveOptions();
PDF1.pDFPreset = "HQP PDF 1.7 Bleed .125 - marks .125";
PDF2.pDFPreset = "[Smallest File Size]";
app.activeDocument.saveAs(file1, PDF1);
app.activeDocument.saveAs(file2, PDF2);
app.activeDocument.close();
}
Copy link to clipboard
Copied
HQP PDF 1.7 Bleed .125 - marks .125 is what you've named your preset?
If so, it might be a syntax thing with the period in that preset name. Maybe try making a copy of it renamed Test or something simple without any special characters.
Copy link to clipboard
Copied
Yup I've tried replacing it with test etc. It only seems to work with the default 'preinstalled' pdf settings as soon as I flip out the export preset to the canned one it works. How would I go about adding bleeds 0.25" and cropmarks 0.1875"?
Copy link to clipboard
Copied
Okay so I started from the default export and made changes and saved that preset, and that seemed to have worked now subbing that one in, the other preset was based off of a preset's saved preset maybe that broke its internal dialogue before, so all good now. thanks for your response before.
Copy link to clipboard
Copied
Dear all, thank you for this script.
Can someone explain to me how I can add the action "select all > change to lettercontour"?
Thank you! Linda
Copy link to clipboard
Copied
var frames = app.activeDocument.textFrames;
for(var f=0;f<frames.length;f++)
{
frames[f].createOutline();
}
Copy link to clipboard
Copied
Nice script. It works. Both PDF saving and Outline conversion. I would just like to ask for clarifications:
1. How can I make the files save or the file into a new *.ai file? instead of PDFs.
2. How can I convert the texts to outlines if the font (embedded in the PDF is not present in my OS?) It currently opens the file for me, changing the font and converting it to curves.
Would it be possible to convert this to the embedded PDF level?
3. If the text in the original file inadvertently contains overset text (symbol [+] on text block), is it possible to insert an ALLERT before converting to outlines?
Basically I'm looking for a way to open *.pdf files by converting the paths (taking advantage of the font embedded in the pdf).
How many of you have experienced the situation that they send you a pdf, a logo and you don't have the font?
There is a solution with Acrobat that converts everything into vectors but it is a very cumbersome solution.
Copy link to clipboard
Copied
1. change the extension in the output file name to ".ai" instead of ".pdf" and remove the PDFSaveOptions
2. loop all the textFrames and outline them with textFrame.createOutline();
3. yes, you could send an alert. you could also use the script to shrink the text until it is no longer overset, then createOutline()
Copy link to clipboard
Copied
So I attach the script done so far.
a) Opens me *.ai,pdf files etc., Saves me in different formats (ai, pdf)
b) If the font is installed in the OS the script works 100%.
c) When and what doesn't work: If the font is not present in the system, or if the text block is not fully open [+] .
d) How could convert to curves be done before Illustrator opens the document and then locates the missing fonts?
Workaround: AFFINITY DESIGNER! They thought to put a nice (beautiful) check before opening the pdf. Do you want to convert the texts to curves before I import the pdf into the file?? YES!!!!
the ADOBE? He is sleeping!
var files = File.openDialog("Select files", "*.ai, *.pdf", true);
for (var i = 0; i < files.length; i++) {
app.open(files[i]);
var frames = app.activeDocument.textFrames;
for(var f=0; f<frames.length;f++) {
frames[f].createOutline();
}
}
for (var i = 0; i < files.length; i++) {
app.open(files[i]);
var file0 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.ai");
var file1 = new File(String(files[i].fullName).slice(0, -3) + "_HiRes.pdf");
var file2 = new File(String(files[i].fullName).slice(0, -3) + "_LowRes.pdf");
var PDF1 = new PDFSaveOptions();
var PDF2 = new PDFSaveOptions();
PDF1.pDFPreset = "[Qualità tipografica]";
PDF2.pDFPreset = "[Dimensione file minima]";
app.activeDocument.saveAs(file0);
app.activeDocument.saveAs(file1, PDF1);
app.activeDocument.saveAs(file2, PDF2);
app.activeDocument.close();
}
Copy link to clipboard
Copied
my question >> https://community.adobe.com/t5/illustrator-discussions/how-can-i-call-these-functions-in-ai-via-scri...
For Converting a PDF to Paths (texts), I think I've found the solution.
Set PDF file as link
Select All
Object / convert transparency
Use a transparency preset with set convert texts to outlines
Done!
I have in mind the schema for a script that does this, but I'm not capable of it, my notions in JSX are limited and Half a day of research on google has not brought me any results.
If someone is capable, let's talk about it.
https://www.youtube.com/watch?v=pUQ1YxEkRqI&t=63s