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

Automatic PDF export

Community Beginner ,
Feb 21, 2023 Feb 21, 2023

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

TOPICS
Import and export , Scripting

Views

1.1K

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

correct answers 1 Correct answer

Community Expert , Feb 21, 2023 Feb 21, 2023

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
...

Votes

Translate

Translate
Adobe
Community Expert ,
Feb 21, 2023 Feb 21, 2023

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

Best regards

Votes

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 ,
Feb 21, 2023 Feb 21, 2023

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?

Votes

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 Expert ,
Feb 21, 2023 Feb 21, 2023

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.

Screenshot 2023-02-21 at 8.41.33 PM.png

 

Best regards

Votes

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 ,
Feb 21, 2023 Feb 21, 2023

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

Votes

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 Expert ,
Feb 21, 2023 Feb 21, 2023

Copy link to clipboard

Copied

LATEST

Ahh, No problem.. 🙂

Best regards

Votes

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