Created
January 17, 2018 15:08
-
-
Save martgnz/d40ab35b5d69caea00918d8aed807ef1 to your computer and use it in GitHub Desktop.
Batch convert PDF to AI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(thisObj) { | |
main(); | |
function main() { | |
var pdffiles = File.openDialog( | |
'Select one or more PDF files', | |
'*.pdf', | |
true, | |
); | |
if (pdffiles === null) { | |
return; | |
} | |
for (var f = 0; f < pdffiles.length; f++) { | |
var pdf = pdffiles[f]; | |
//~ alert(pdf); | |
var doc = app.open(pdf); | |
var namepattern = pdf.path + '/' + pdf.name + '.converted.ai'; | |
var newai = null; | |
if (!File(namepattern).exists) { | |
newai = new File(namepattern); | |
} else { | |
newai = File(namepattern); | |
} | |
doc.saveAs(newai); | |
doc.close(SaveOptions.DONOTSAVECHANGES); | |
} | |
} | |
})(this); |
It works great.
- save the above code as "pdf2ai.jsx";
- open Adobe Illustrator;
- go to "File" -> "Script" -> "Other Script..." -> Choose the file pdf2ai.jsx -> Choose the PDF files
- (support multiple pdf files at once)
Awesome. Thanks alot. Is it somehow possible to shrink down the "artboard" of each AI file to its corresponding layers within? All the AI files that have been created by Illustrator now have a greater Artboard than neccessary.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! time saving! thanks you so much