Copy link to clipboard
Copied
how can I export all individual layers in indesign to a photoshop file with the same layer structure?
is there a script you can use?
thanks
If you are on a Mac this Applescript will do it:
The script exports PDFs of the ID layers and reassembles them in PS. In order to get the layers to register you need to include registration marks in the PDF preset you choose—the zip archive includes the preset I use. After running the script you can use canvas size to eliminate the crop marks.
Copy link to clipboard
Copied
Oh wait, I see that your error is the missing PDF/X problem. Nevermind about the log I'll post a fix.
Copy link to clipboard
Copied
For some reason I didn't get an email notification for your response to my post - I apologize for not replying sooner! I did manage to get the script to work though. Following your instructions in your earlier response to mckoenig, I created a new pdf preset with PDF/X-4:2008 Compatibility / Acrobat (PDF1.4) and named it PSDLayers. I then changed "set myPDFPreset to "[PDF/X-4:2007]" to "set myPDFPreset to "PSDLayers" in the script. I'm not sure why I couldn't get it working right the first time around, but I've had no problems with it since. Thanks again for the great script
Copy link to clipboard
Copied
This version should solve the missing PDF preset problems. I've added the dropdown menu with all available PDF presets. PDF/X-4 works best for color management:
Copy link to clipboard
Copied
Thanks so much, but still no luck. The first two layers open in PS, but each one as a seprate document. Then, this error message pops up.
Copy link to clipboard
Copied
What version of Photoshop are you running?
Copy link to clipboard
Copied
PS5
Copy link to clipboard
Copied
Lets try the log idea. See my post 46. Try a simple document with a couple of layers so the log is short.
Copy link to clipboard
Copied
Sounds good. Here's the log:
tell application "Adobe Photoshop CS5"
count every document of current application
0
end tell
tell application "Adobe InDesign CS5"
activate
count every document of current application
7
get active document
document id 7
get name of document id 7
"test_1.indd"
get horizontal measurement units of view preferences of document id 7
inches
get vertical measurement units of view preferences of document id 7
inches
set horizontal measurement units of view preferences of document id 7 to inches
set vertical measurement units of view preferences of document id 7 to inches
get page height of document preferences of document id 7
11.0
get page width of document preferences of document id 7
8.5
get pages per document of document preferences of document id 7
1
choose folder with prompt "Please select the folder you want to save your PDF pages in"
alias "Macintosh HD:Users:amelia:Desktop:test 1:"
make with properties {name:"Export to Photoshop"} new dialog
dialog id 538053
make new dialog column
dialog column id 97832 of dialog id 538053
make new border panel
border panel id 97833 of dialog column id 97832 of dialog id 538053
make new dialog column
dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make new dialog row
dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make with properties {static label:"Color Mode:"} new static text
static text id 97836 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make with properties {string list:{"RGB", "CMYK", "Lab"}, selected index:0} new dropdown
dropdown id 97837 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make new dialog row
dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make with properties {static label:"Page to Export:"} new static text
static text id 97839 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make with properties {edit contents:"1"} new real editbox
real editbox id 97840 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make new dialog row
dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make with properties {static label:"Resolution:"} new static text
static text id 97842 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make with properties {edit contents:"300"} new real editbox
real editbox id 97843 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make new dialog row
dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
make with properties {static label:"Antialias", checked state:false} new checkbox control
checkbox control id 97845 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
show dialog id 538053
true
get selected index of dropdown id 97837 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
0
get edit value of real editbox id 97840 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
1.0
get edit value of real editbox id 97843 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
300.0
get checked state of checkbox control id 97845 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 538053
false
destroy dialog id 538053
count every layer of document id 7
3
get name of every layer of document id 7
{"Layer 3", "Layer 2", "Layer 1"}
set visible of every layer of document id 7 to false
set visible of layer 3 of document id 7 to true
set page range of PDF export preferences to "1"
set view PDF of PDF export preferences to false
export document 1 format PDF type to "Macintosh HD:Users:amelia:Desktop:test 1:13test_1.indd" using PDF export preset "[PDF/X-4:2007]"
"Adobe InDesign CS5 got an error: Invalid value for parameter 'using' of method 'export'. Expected PDF export preset, but received nothing."
Copy link to clipboard
Copied
This is from the older version. Try it with the version I just posted in #49— PageToPSLayersV2
Copy link to clipboard
Copied
Hmm, sorry about that. I retried with the version from #49. Here's the error message and the event log. Thanks again for troubel shooting this with me, I really
appriate it.
tell application "Adobe Photoshop CS5"
count every document of current application
0
end tell
tell application "Adobe InDesign CS5"
activate
count every document of current application
7
get active document
document id 7
get name of document id 7
"test_1.indd"
get horizontal measurement units of view preferences of document id 7
inches
get vertical measurement units of view preferences of document id 7
inches
set horizontal measurement units of view preferences of document id 7 to inches
set vertical measurement units of view preferences of document id 7 to inches
get page height of document preferences of document id 7
11.0
get page width of document preferences of document id 7
8.5
get pages per document of document preferences of document id 7
1
choose folder with prompt "Please select the folder you want to save your PDF pages in"
alias "Macintosh HD:Users:amelia:Desktop:test 1:"
make with properties {name:"Export to Photoshop (PDF/X-4 Preset Recommended)"} new dialog
dialog id 541119
make new dialog column
dialog column id 97832 of dialog id 541119
make new border panel
border panel id 97833 of dialog column id 97832 of dialog id 541119
make new dialog column
dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make new dialog row
dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
get name of every PDF export preset
{"[High Quality Print]", "[PDF/X-1a:2001]", "[PDF/X-3:2002]", "[PDFX4 2007]", "[PDF/X-4:2008]", "[Press Quality]", "[Smallest File Size]"}
make with properties {static label:"PDF Preset:"} new static text
static text id 97836 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {string list:{"[High Quality Print]", "[PDF/X-1a:2001]", "[PDF/X-3:2002]", "[PDFX4 2007]", "[PDF/X-4:2008]", "[Press Quality]", "[Smallest File Size]"}, selected index:4, min width:250} new dropdown
dropdown id 97837 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make new dialog row
dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {static label:"Color Mode:"} new static text
static text id 97839 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {string list:{"RGB", "CMYK", "Lab"}, selected index:0, min width:250} new dropdown
dropdown id 97840 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make new dialog row
dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {static label:"Page to Export:"} new static text
static text id 97842 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {edit contents:"1"} new real editbox
real editbox id 97843 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make new dialog row
dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {static label:"Resolution:"} new static text
static text id 97845 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {edit contents:"300"} new real editbox
real editbox id 97846 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make new dialog row
dialog row id 97847 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
make with properties {static label:"Antialias", checked state:false} new checkbox control
checkbox control id 97848 of dialog row id 97847 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
show dialog id 541119
true
get selected index of dropdown id 97837 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
4
get selected index of dropdown id 97840 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
0
get edit value of real editbox id 97843 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
1.0
get edit value of real editbox id 97846 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
300.0
get checked state of checkbox control id 97848 of dialog row id 97847 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 541119
false
destroy dialog id 541119
count every layer of document id 7
3
get name of every layer of document id 7
{"Layer 3", "Layer 2", "Layer 1"}
set visible of every layer of document id 7 to false
set visible of layer 3 of document id 7 to true
set page range of PDF export preferences to "1"
set view PDF of PDF export preferences to false
export document 1 format PDF type to "Macintosh HD:Users:amelia:Desktop:test 1:13test_1.indd" using PDF export preset "[PDF/X-4:2008]"
end tell
tell application "Adobe Photoshop CS5"
activate
«event PsCSodoc» file "Macintosh HD:Users:amelia:Desktop:test 1:13test_1.indd" given «class FmOp»:{class:«class cGPF», «class CPrP»:true, «class OMde»:«constant ****e082», «class ResL»:300, «class AnAl»:false, «class crto»:«constant ****crt5»}
current application
end tell
tell application "Adobe InDesign CS5"
set visible of every layer of document id 7 to false
set visible of layer 2 of document id 7 to true
set page range of PDF export preferences to "1"
set view PDF of PDF export preferences to false
export document 1 format PDF type to "Macintosh HD:Users:amelia:Desktop:test 1:12test_1.indd" using PDF export preset "[PDF/X-4:2008]"
end tell
tell application "Adobe Photoshop CS5"
activate
«event PsCSodoc» file "Macintosh HD:Users:amelia:Desktop:test 1:12test_1.indd" given «class FmOp»:{class:«class cGPF», «class CPrP»:true, «class OMde»:«constant ****e082», «class ResL»:300, «class AnAl»:false, «class crto»:«constant ****crt5»}
current application
get every document
{}
"Can’t get item 0 of {}."
Copy link to clipboard
Copied
I can see that it's breaking on the Photoshop PDF open command. Are you running the most recent Photoshop (12.0.4)? What's the version of your OSX? I have not tested the script with Lion.
Copy link to clipboard
Copied
No, I'm running PS 12.0.
I'm on OS 10.5.8.
Copy link to clipboard
Copied
No, I'm running PS 12.0.
Try updating to the most recent 12.0.4. I don't think there was full scripting support in 12.0.
http://www.adobe.com/support/downloads/product.jsp?product=39&platform=Macintosh
Copy link to clipboard
Copied
Rob, that did the trick! I can't thank you enough for your patience and
perseverance. The script works beautifully. Bravo!
Copy link to clipboard
Copied
Your welcome. I'll update the read me so users know about the 12.0 problem.
Copy link to clipboard
Copied
hello rob,
I have stupidly used indesign to create this whole website layout, so now i need to export it to photoshop for the web guy to code....
Thank you for the script, it is fantastic! - the answer to my prayers (...nearly)
it's just, with the script you've provided, it exports all the layers and flattens all my sub-layers/items in those layers.
.... say i've created a navigation bar, and i've group all the items into one big layer, it gets flattened when exported...
I know i've dug my own hole, and should probably just make the items into layers, but it will take too long and there's so many pages...
do you happen to have a solution? or did i just confuse you more?
thanks!
Copy link to clipboard
Copied
It would be possible to script but it wouldn't be trivial, you'd have to consider groups, inline graphics, and maybe Photoshop's total layer limit.
Copy link to clipboard
Copied
Try this version, which uses a different open command:
Copy link to clipboard
Copied
Still no good. See error message and event log.
tell application "Adobe Photoshop CS5"
count every document of current application
0
end tell
tell application "Adobe InDesign CS5"
activate
count every document of current application
9
get active document
document id 7
get name of document id 7
"test_1.indd"
get horizontal measurement units of view preferences of document id 7
inches
get vertical measurement units of view preferences of document id 7
inches
set horizontal measurement units of view preferences of document id 7 to inches
set vertical measurement units of view preferences of document id 7 to inches
get page height of document preferences of document id 7
11.0
get page width of document preferences of document id 7
8.5
get pages per document of document preferences of document id 7
1
choose folder with prompt "Please select the folder you want to save your PDF pages in"
alias "Macintosh HD:Users:amelia:Desktop:test 1:untitled folder:"
make with properties {name:"Export to Photoshop (PDF/X-4 Preset Recommended)"} new dialog
dialog id 546806
make new dialog column
dialog column id 97832 of dialog id 546806
make new border panel
border panel id 97833 of dialog column id 97832 of dialog id 546806
make new dialog column
dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make new dialog row
dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
get name of every PDF export preset
{"[High Quality Print]", "[PDF/X-1a:2001]", "[PDF/X-3:2002]", "[PDFX4 2007]", "[PDF/X-4:2008]", "[Press Quality]", "[Smallest File Size]"}
make with properties {static label:"PDF Preset:"} new static text
static text id 97836 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {string list:{"[High Quality Print]", "[PDF/X-1a:2001]", "[PDF/X-3:2002]", "[PDFX4 2007]", "[PDF/X-4:2008]", "[Press Quality]", "[Smallest File Size]"}, selected index:4, min width:250} new dropdown
dropdown id 97837 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make new dialog row
dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {static label:"Color Mode:"} new static text
static text id 97839 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {string list:{"RGB", "CMYK", "Lab"}, selected index:0, min width:250} new dropdown
dropdown id 97840 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make new dialog row
dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {static label:"Page to Export:"} new static text
static text id 97842 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {edit contents:"1"} new real editbox
real editbox id 97843 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make new dialog row
dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {static label:"Resolution:"} new static text
static text id 97845 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {edit contents:"300"} new real editbox
real editbox id 97846 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make new dialog row
dialog row id 97847 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
make with properties {static label:"Antialias", checked state:false} new checkbox control
checkbox control id 97848 of dialog row id 97847 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
show dialog id 546806
true
get selected index of dropdown id 97837 of dialog row id 97835 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
4
get selected index of dropdown id 97840 of dialog row id 97838 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
0
get edit value of real editbox id 97843 of dialog row id 97841 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
1.0
get edit value of real editbox id 97846 of dialog row id 97844 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
300.0
get checked state of checkbox control id 97848 of dialog row id 97847 of dialog column id 97834 of border panel id 97833 of dialog column id 97832 of dialog id 546806
false
destroy dialog id 546806
count every layer of document id 7
3
get name of every layer of document id 7
{"Layer 3", "Layer 2", "Layer 1"}
set visible of every layer of document id 7 to false
set visible of layer 3 of document id 7 to true
set page range of PDF export preferences to "1"
set view PDF of PDF export preferences to false
export document 1 format PDF type to "Macintosh HD:Users:amelia:Desktop:test 1:untitled folder:13test_1.indd" using PDF export preset "[PDF/X-4:2008]"
end tell
tell application "Adobe Photoshop CS5"
activate
«event PsCSodoc» alias "Macintosh HD:Users:amelia:Desktop:test 1:untitled folder:13test_1.indd" given «class FmOp»:{class:«class cGPF», «class CPrP»:true, «class OMde»:«constant ****e082», «class ResL»:300, «class AnAl»:false, «class crto»:«constant ****crt5»}
current application
end tell
tell application "Adobe InDesign CS5"
set visible of every layer of document id 7 to false
set visible of layer 2 of document id 7 to true
set page range of PDF export preferences to "1"
set view PDF of PDF export preferences to false
export document 1 format PDF type to "Macintosh HD:Users:amelia:Desktop:test 1:untitled folder:12test_1.indd" using PDF export preset "[PDF/X-4:2008]"
end tell
tell application "Adobe Photoshop CS5"
activate
«event PsCSodoc» alias "Macintosh HD:Users:amelia:Desktop:test 1:untitled folder:12test_1.indd" given «class FmOp»:{class:«class cGPF», «class CPrP»:true, «class OMde»:«constant ****e082», «class ResL»:300, «class AnAl»:false, «class crto»:«constant ****crt5»}
current application
get every document
{}
"Can’t get item 0 of {}."
Copy link to clipboard
Copied
Rob, great script. An extra Christmas present as I'm in need of creating layered PS files of quite number of InD files that I've already created for a client who is now demanding PS instead of InD.
The only thing that I'm trying to get in the PS now is the crop marks and a bleed of .125". I've made a PDF preset that is such and I select that preset once the dialogue box comes up when the script is activated. But, I don't get either the bleed or crop marks in the final PS document.
If you have any suggestions, I'd REALLY appreciate it.
Thanks,
Rick
Copy link to clipboard
Copied
Rob,
I just did a work-around by changing the size of my InD document to include the bleed and then have added guides in PS for client reference.
Thanks again for the great script — it's working flawlessly.
Rick
Copy link to clipboard
Copied
I'm traveling, the script sets the PDF bounds to the trim, but it could include crops. I'll post something later today.
Copy link to clipboard
Copied
Rob,
Thank you for your quick reply. First of all, thanks for the super time saving script. It's working great.
I've done a work around by changing the InD document size to include the .125 of bleed I need and then in PS I'm adding the guides for the client reference. So, thank you and whenever you get around to it — I'd certainly take the updated script the next time I need to do this.
Who wants a layout in PS anyway? Dang clients.
Thanks Rob.
Rick
Copy link to clipboard
Copied
Who wants a layout in PS anyway? Dang clients.
You don't mean this is a print job? Hope you're getting paid up front.
To include the PDF preset's crops you need to edit the script. Look for the 3 lines where the crop page is set to trim box and change to bounding box.
So this:
if colorMode is "CMYK" then
set myOpenOptions to {class:PDF open options, constrain proportions:true, mode:CMYK, resolution:res, use antialias:aa, crop page:trim box}
else
if colorMode is "RGB" then
set myOpenOptions to {class:PDF open options, constrain proportions:true, mode:RGB, resolution:res, use antialias:aa, crop page:trim box}
else
if colorMode is "Lab" then
set myOpenOptions to {class:PDF open options, constrain proportions:true, mode:Lab, resolution:res, use antialias:aa, crop page:trim box}
end if
end if
end if
Needs to be:
if colorMode is "CMYK" then
set myOpenOptions to {class:PDF open options, constrain proportions:true, mode:CMYK, resolution:res, use antialias:aa, crop page:bounding box}
else
if colorMode is "RGB" then
set myOpenOptions to {class:PDF open options, constrain proportions:true, mode:RGB, resolution:res, use antialias:aa, crop page:bounding box}
else
if colorMode is "Lab" then
set myOpenOptions to {class:PDF open options, constrain proportions:true, mode:Lab, resolution:res, use antialias:aa, crop page:bounding box}
end if
end if
end if
Copy link to clipboard
Copied
Hey Rob.
Yeah, this is a print job! Crazy. He's got InDesign too!
We're past being billable on this one.
Thanks for the edit to the script.