there’s quite a farcical discussion going on over at the InDesign forum — Is there really no way to export PDFs as separate pages? as is so often the case in these forums, a person asks HOW to do something and then there’s an extended, often heated, discussion about WHY you would/wouldn’t or should/shouldn’t do it that way.
but the argy-bargy is unnecessary because there are some truly legitimate workflows that would benefit from this capability — like the guy at comment 39 — and because exporting each InDesign page as a separate PDF is really easy with Applescript.
today we’ll be looking at a simplified version of the script from lessons 11 and 12. we start by collecting the filename and file path of the active document. then we shorten the filename to exclude the extension — so “this file.indd” becomes “this file” (mgShortName):
tell application id "com.adobe.InDesign" set mgFolder to file path of active document set mgName to name of active document set text item delimiters of AppleScript to {"."} set mgShortName to text item 1 of mgName set text item delimiters of AppleScript to "" end tell
next we’ll create a subfolder for the pdfs to be saved into. you do this through the finder by first checking if the subfolder already exists and, if not, creating it. we’re calling this subfolder “the pdfs” and it will be created in the same folder as the indesign file :
tell application "Finder" if (exists folder "the pdfs" of folder mgFolder) is false then make folder at mgFolder with properties {name:"the pdfs"} end if end tell
then it’s just a matter of a simple repeat loop, cycling through each page in the document. we’re using the page number (name of page) as part of the filename so, using the example above, we’ll end up with “this file_1.pdf”, “this file_2.pdf”, etc. and we complete the script with a simple dialog to let us know when it has done its thing :
tell application id "com.adobe.InDesign" repeat with x from 1 to count pages of active document set mgPageName to name of page x of active document set page range of PDF export preferences to mgPageName set mgFilePath to mgFolder & "the pdfs:" & mgShortName & "_" & mgPageName & ".pdf" as string tell active document export format PDF type to mgFilePath using "macgrunt offset" without showing options end tell end repeat display dialog "ALL DONE!" buttons {"OK"} default button 1 giving up after 2 end tell
notice that when we specify mgFilepath we add a colon to “the pdfs” — this is what designates it as a folder. the full file path might be something like this “Macintosh HD:Users:macgrunt:Documents:the pdfs:this file_1.pdf” — this shows a hierarchy of five folders — everything after that last colon is the name of the file. so, if we didn’t add the colon after “the pdfs” the filename would have been “the pdfsthis file_1.pdf” (hopefully that makes sense).
note also that “macgrunt offset” is the name of the PDF export preset — you would need to substitute your own preset name here.
so that’s the basic functionality for exporting every page as a separate PDF. copy those three sections into a single script in applescript editor and you’re away. there are a bunch of macgrunt lessons showing other PDF export workflows and considerations — just enter “export pdf” up there in the search field.
the next lesson will look at a couple of other, more complex, ways we could approach the naming of these separate page PDFs.
until then, keep grunting.
Pingback: Breaking up is hard to do… InDesign files into individual PDFs that is! | Colecandoo!
Must admit that I was one of the guilty parties on that forum thread that provided an opinion before providing a solution. However, further into the threads I did offer three links that had solutions available for both Acrobat and within InDesign itself, though not necessarily a turnkey solution as you have provided.
Admittedly I have a use for that variety of script from time to time but found that Loic Aigon’s script worked well because it was suitable not just for a generally large document, but also a data merged document, where the PDF filenames would have to feature the primary key entry of the database.
But for simply breaking a large indesign file into one page PDFs, your method certainly much more efficient making a PDF, using the split document feature in acrobat, and then renaming via bridge if necessary.
ah, well, ‘guilty’ is a pretty strong word – and hey, you got the bonus points for being correct. :-)+)
i think it’s important to point out when a particular workflow is bizarre (which individual prepess files certainly is) but only if you’re also willing to at least attempt to answer the OPs question (which you did). anyone who just throws their two cents into the “yes-it-is, no-it-isn’t” debate is wasting everyone’s time. whether or not it’s a recommended workflow is irrelevant to the OPs problem.
thanks for the feedback, and thanks for posting that link to Loic’s script — i’ll be linking to that in the next post when i look at a couple of file naming options. only amateur stuff of course — nothing like the megalithic awesomeness that Loic does.
have a good one.
m.