Script to save lowres and hires

New Here ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

Hello,

 

i am looking for a script that saves a lowres and hires version of my artwork.

I look the forums but to no avail.

 

Im working with version illustrator 26.1

Thanks in advance!

TOPICS
Import and export , Scripting

Views

148

Likes

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
Advocate ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

Hello @Andersom2,

 

You're not very specific on what you mean by "i am looking for a script that saves a lowres and hires version of my artwork."......lowres and hires what?? and what are you referring to when you say "artwork"?

The below script will export lowres and hires pdfs of the opened AI file...I hope this suits your needs.

var main = function() {
var doc = app.documents[0];
var myFile = doc.fullName;
var myFolder = doc.path;
fileName = doc.name.replace(/\.ai|\.eps/gi, "");

{
var pdfExport = new PDFSaveOptions();  
pdfExport.pDFPreset = '[Smallest File Size]'; 
app.activeDocument.saveAs(File(myFolder + "/" + fileName + "_LR.pdf"), pdfExport);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.open(myFile);
}
{
var pdfExport = new PDFSaveOptions();  
pdfExport.pDFPreset = '[High Quality Print]'; 
app.activeDocument.saveAs(File(myFolder + "/" + fileName + "_HR.pdf"), pdfExport);  
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.open(myFile);
}
}
main();

 

Regards,

Mike

Likes

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 ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

Hello @mikeb41294032,

Do you know how to replace an existing pdf file with the same name (including the _LR) when using the script?

Thank you so much

Likes

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
Adobe Community Professional ,
Mar 15, 2022 Mar 15, 2022

Copy link to clipboard

Copied

Hi @Reiby 

Could you please add clear specifications?

Best regards

Likes

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 ,
Mar 16, 2022 Mar 16, 2022

Copy link to clipboard

Copied

Thanks!

 

In my work I export many pdfs to continually send them for review/validation. I follow this procedure:

 

0) Open document I have to work with
1) I proceed to "save as"
2) I save pdf an the same folder as the open document, with the same name as the original file illustrator + _LR example ->> namedocument_LR.pdf
3) I save the pdf in low resolution. If there is no pdf there is no problem, but if there is an older version of the pdf (same name) I replace it with the new pdf .

Then I continue working on the document or open a new one.

 

I have tried other scipts but the problem is that they generate many pdf instead of replacing the previous version:

 

My folders usually look like this:

Folder Links

Folder Fonts

Documentname.ai

Documentname_LR.pdf -> I send this for review

 

Some scripts I've tried do this:

Folder Links

Folder Fonts

Documentname.ai

Documentname_LR.pdf

Documentname_LR_LR.pdf ->does not replace the pdf of the previous version 

 

Is there any way to speed up the process? I do the same operation 20 times a day!

Thank you very much!

Likes

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
Advocate ,
Mar 16, 2022 Mar 16, 2022

Copy link to clipboard

Copied

LATEST

hello @Reiby,

 

The modified script below will remove the "Documentname_LR.pdf" if it exist prior to exporing...

var main = function() {
var doc = app.documents[0];
var myFile = doc.fullName;
var myFolder = doc.path;
fileName = doc.name.replace(/\.ai|\.eps/gi, "");

var my_LR_PDF = File(myFolder + "/" + fileName + "_LR.pdf");  
if (my_LR_PDF.exists){ 
   my_LR_PDF.remove();
 }

{
var pdfExport = new PDFSaveOptions();  
pdfExport.pDFPreset = '[Smallest File Size]'; 
app.activeDocument.saveAs(File(myFolder + "/" + fileName + "_LR.pdf"), pdfExport);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.open(myFile);
}
{
var pdfExport = new PDFSaveOptions();  
pdfExport.pDFPreset = '[High Quality Print]'; 
app.activeDocument.saveAs(File(myFolder + "/" + fileName + "_HR.pdf"), pdfExport);  
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.open(myFile);
}
}
main();

 

Regards,

Mike

Likes

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
Adobe Community Professional ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

Can't the Export for Screens do this?

David Creamer
Adobe Certified Instructor, Adobe Certified Professional, and Adobe Certified Expert (since 1995)

Likes

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