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

export each layer of a InDesign file (with 5 pages) to its own PDF.

Community Beginner ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

I'm not sure if this is possible...but I am looking for a way (possibly a script?) to export each layer of a InDesign file to its own PDF.

I have a 5 page indesign file and each page has 3 layers, so the exported pdf would have 15 pages. Does anyone know of a way to do this?

[Moved by moderator from InDesign to InDesign Scripting]

.

TOPICS
Scripting

Views

8.6K

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 ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

Not knowing script, I would personally make five PDFs and combine them using Acrobat Pro. It would take less than five minutes (maybe three).

But a scripter might be able to automate it for you. I can move this to the scripting forum.

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 ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

If you could move this to the scripting forum that would be good, as sometimes  I could have up to 20 layers on 30 pages (600 pdfs)

Many thanks

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 ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

InDesign cannot combine PDFs or generate more PDF pages than there are in the original document. When exporting one layer at a time you would end up with at least as many separate files as there are layers.

As yours seems a rather strange document (I'm not doubting that you have good reasons to work this way! But as you found out, InDesign doesn't really have a workflow for this): would it be possible to have this hypothetical script add new pages for each layer, copying only what's on it, and then hide that layer? That is, is the contents of every single layer on its own an entire page?

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 ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

What you mentioned is exactly what i need... the contents of every single layer on its own an entire page in a pdf.

I'd love to know if this is possible??

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
People's Champ ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

It is doable, yes. Fairly simple. Just hide all layers, then loop through all layers making a different one visible each time, and each time export the document as PDFs file, one for each page.

Definitely scriptable... If you'd like a quote, feel free to get in touch: admin [at] id-extras.com

Ariel

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
LEGEND ,
Jul 30, 2017 Jul 30, 2017

Copy link to clipboard

Copied

Ariel is right! 

I've just called it:  "0184_EachLayer-PageToPDF_MichelAllio.jsx"

[not for free!]

(^/)

Capture d’écran 2017-07-30 à 16.08.55.png

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
LEGEND ,
Jul 30, 2017 Jul 30, 2017

Copy link to clipboard

Copied

… Interesting, Script version 2: only the pages per layer with something on the layer will be exported as pdf!

With the Script version 1, all the layers of all the pages have been treated => 20 pdf files!

Capture d’écran 2017-07-30 à 21.55.15.png

With the Script version 2, just 10 pdf files!

Capture d’écran 2017-07-30 à 21.54.05.png

(^/)

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
Explorer ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

I wrote a Python script a while ago which might be helpful:

#!/usr/bin/python

# -*- coding: utf-8 -*-

from __future__ import print_function, division, absolute_import

from builtins import super

import win32com.client

import sys

import os

from shutil import copyfile

def patchWin32com():

    # https://stackoverflow.com/q/9383307/321973

    import winerror

    from win32com.client.dynamic import ERRORS_BAD_CONTEXT

    global ERRORS_BAD_CONTEXT

    if not winerror.E_NOTIMPL in ERRORS_BAD_CONTEXT:

        ERRORS_BAD_CONTEXT.append(winerror.E_NOTIMPL)

patchWin32com()

# http://help.adobe.com/livedocs/pdfl_sdk/9/PDFL_SDK9_HTMLHelp/API_References/Acrobat_API_Reference/PD...

PDSaveIncremental = 0x00

PDSaveFull = 0x01

PDSaveCopy = 0x02

PDSaveLinearized = 0x04

PDSaveWithPSHeader = 0x08

PDSaveBinaryOK = 0x10

PDSaveCollectGarbage = 0x20

PDSaveForceIncremental = 0x40

PDSaveKeepModDate = 0x80

SAVEFLAG = PDSaveFull | PDSaveLinearized | PDSaveCollectGarbage

def splitPDFvariants(pdffile):

    """split PDF into logo/print versions

    at the moment, only hides the layers from settings!"""

    pdffile = os.path.abspath(pdffile)

    acropdf = win32com.client.Dispatch('AcroExch.PDDoc')

    for name, logo in (('digital', True), ('print', False)):

        pdfcopy = pdffile.rstrip('.pdf') + '-' + name + '.pdf'

        copyfile(pdffile, pdfcopy)

        assert acropdf.Open(pdfcopy)

        jso = acropdf.GetJSObject()

        ocgs = jso.GetOCGs()

        for ocg in ocgs:

            if ocg.name == 'Logo':  # lock Logo to relevant state

                ocg.initState = logo

                ocg.state = logo

                ocg.locked = True

        jso.SetOCGOrder([])  # remove layers from menu

        assert acropdf.Save(SAVEFLAG, pdfcopy)

        assert acropdf.Close()

if __name__ == '__main__':

    splitPDFvariants(sys.argv[1])

It opens the input argument PDF (created via InDesign, using the "create layers" PDF export option) with Acrobat (Pro) and creates a "digital" and "print" version with the layer "Logo" on and off respectively. With some adaption you can loop through the layers and create individual PDFs for each, and with some more lines you can also merge those PDFs.

Cheers,

Tobias

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 ,
Jul 28, 2017 Jul 28, 2017

Copy link to clipboard

Copied

Thanks Tobias.

Sorry I know next to nothing about scripting, what should I do with your Python script to make it a usable script in Indesign?

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
Explorer ,
Aug 01, 2017 Aug 01, 2017

Copy link to clipboard

Copied

LATEST

Dawn Stiles  wrote

Thanks Tobias.

Sorry I know next to nothing about scripting, what should I do with your Python script to make it a usable script in Indesign?

Sorry for the brevity, the script runs independently of InDesign. You just run it via command line and pass the PDF file path and name as argument, e.g.

python exporter.py c:\users\me\Documents\somewhere\thing.pdf

You can run this on a machine without InDesign, but instead you need Acrobat Pro. This also works for other PDFs not generated by InDesign. But as mentioned, the scripts needs a few modifications to actually extract all layers, for which I'm currently lacking the time.

Cheers,

Tobias

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
People's Champ ,
Jul 30, 2017 Jul 30, 2017

Copy link to clipboard

Copied

You may have it as a plugin :

Pour Editeurs [axaio]

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