Copy link to clipboard
Copied
Hi community,
I would like your opinion on a script for automatic saving in pdf format.
to explain my request, I have a document with two layers "Text" and "Background" and I would like to know if a script already exists that could allow me to export a file per sub-layer contained in "Background" while leaving the "Text" layer active and visible on all my documents so that it can save me in pdf format one file per "Background" layer
Thank you in advance for your assistance
Hi,
Try the following version
function main() {
var _doc = app.activeDocument;
var _backgroundLayer = _doc.layers['Background'];
var _pageItems = _backgroundLayer.pageItems;
var pdfOptions = new PDFSaveOptions();
pdfOptions.compatibility = PDFCompatibility.ACROBAT5;
pdfOptions.generateThumbnails = true;
pdfOptions.preserveEditability = false;
pdfOptions.preset = "[Smallest File Size]";
for (var s = 0; s < _pageItems.length; s++) {
hideItems(_backgrou
...
Copy link to clipboard
Copied
Hi,
Try the following version
function main() {
var _doc = app.activeDocument;
var _backgroundLayer = _doc.layers['Background'];
var _pageItems = _backgroundLayer.pageItems;
var pdfOptions = new PDFSaveOptions();
pdfOptions.compatibility = PDFCompatibility.ACROBAT5;
pdfOptions.generateThumbnails = true;
pdfOptions.preserveEditability = false;
pdfOptions.preset = "[Smallest File Size]";
for (var s = 0; s < _pageItems.length; s++) {
hideItems(_backgroundLayer);
_pageItems[s].hidden = false;
var pdfFile = new File(_doc.path + "/" + _pageItems[s].name + '.pdf');
_doc.saveAs(pdfFile, pdfOptions);
}
}
function hideItems(_backgroundLayer) {
for (var s = 0; s < _backgroundLayer.pageItems.length; s++) {
_backgroundLayer.pageItems[s].hidden = true;
}
}
main();
Adding more links:
https://github.com/mericson/illustrator-scripts/blob/master/MultiExporter.jsx
Copy link to clipboard
Copied
Hi @Charu Rajput and thanks for your help.
I just tested this script and nothing happens. I had no error message or exported pdf files. Have you on your side with my file been able to export the pdf files as I wish?
Copy link to clipboard
Copied
Hi, @Magnetik85 ,
Yes, I am able to export. I have used attached document background.eps file and PDF file with name BG1.pdf, BG2.pdf and BG3. pdg created at the same path where background.eps file exists.
 
Copy link to clipboard
Copied
Excuse me @Charu Rajput but I had not called the function at the end of your code.
Sorry for the inconvenience and thank you again for your help.
Best Regards
Copy link to clipboard
Copied
Ahh, No problem.. 🙂