Contents
- Introduction
- Basic Custom File Naming
- Overwriting Existing Files
- Advanced Custom File Naming
- Mix and Match
- Errors
- Questions and Comments
Introduction
Extract Pages is a great InDesign script to divide an existing InDesign document into separate pages or groups of pages.
Each page, or group of pages, is saved as a separate file.
The script will produce InDesign, PDF, interactive PDF, JPG, PNG and InDesign snippet files and any combination of these.
The filename pattern can be modified by the user. Some very powerful building blocks allow for a wide variety of filename patterns to be specified easily.
Everything described below is equally applicable whether you are producing PDF, InDesign, PNG or JPEG files or InDesign snippet files. All file-naming options are available for all file formats. For simplicity we presume you are creating InDesign files, but the naming results are identical if you are creating other files from your source file.
For ease of use, a useful “default” filename pattern is also available for users for whom this is sufficient.
This article will describe how to use the advanced filenaming feature of Extract Pages.
Basic Custom File Naming
To use a custom filenaming scheme, select the “Custom” radio button, and type the filenaming scheme you would like to use.
For instance, if you type:
Ace Food
and choose to save each page of a 10-page file as separate files, the file names will become:
Ace Food.indd Ace Food-1.indd Ace Food-2.indd ... Ace Food-9.indd
Overwriting Existing Files
Extract Pages will not overwrite existing files in the same folder that have the same name.
So if a file called Ace Foods.indd already exists in the selected folder, Extract Pages will automatically modify the name to something that does not exist already: Ace Foods-1.indd.
If, as per the previous example, Ace Foods-1.indd through Ace Foods-9.indd are all used, the first file will be called Ace Foods-10.indd.
The point is that Extract Pages will find a new name for all files, and will not overwrite existing files. So if needed, first manually delete all existing files from the selected folder.
Advanced Custom File Naming
In addition to simple custom file names, any of the following special codes can be inserted one or more times into the Custom filename field to create advance naming schemes.
First Page <fp> and <+fp>
The <fp> code will be replaced, for each extracted file, with the name of the first page of that file. The <+fp> code will be replaced, for each extracted file, with the number of the first page of that file. For example, typing the following into the Custom field (using the 10-page Ace Foods example mentioned previously):
Ace Foods Page <fp>
will result in the following files:
Ace Foods Page 1.indd Ace Foods Page 2.indd ... Ace Foods Page 10.indd
Last Page <lp> and <+lp>
As with the <fp> code, the <lp> code will be replaced with the name of the last page of the extracted file. The <+lp> code will be replaced with the number of the last page of the extracted file. For example, if we were to split the Ace Food file into two (pages 1-5, and pages 6-10), typing the following in the Custom field:
Ace Foods Pages <fp>-<lp>
would result in the following 2 files:
Ace Foods Pages 1-5.indd Ace Foods Pages 6-10.indd
File Name <fn>
The <fn> code just inserts the full name of the original file.
So, if the original file was called Ace Foods.indd, and it is divided into 2 sections as above, typing
<fn> Pages <fp>-<lp>
would again result in:
Ace Foods Pages 1-5.indd Ace Foods Pages 6-10.indd
Counter #
The hash sign # can be used as a placeholder for a simple counter. For the first extracted file, it will have a value of 1. For the second, 2, and so on.
Multiple ### can also be used to pad the number with leading zeros. So ### will be replaced with 001 for the first file and 002 for the second, etc.
For example, typing the following into the Custom field
## Ace Foods
will result in
01 Ace Foods.indd 02 Ace Foods.indd
… and so on for each file created.
Conditional Text [ ]
Use square brackets [ ] to mark text as conditional.
Conditional text will only be used if the extracted file contains more than 1 page.
This is useful for sorting out singular/plural issues.
For example, if Ace Foods.indd contains 10 pages, and we want to divide it into 3 files: pages 1-3, page 4, and pages 5-10, we could type the following into the Custom field:
### <fn> Page[s] <fp> [through <lp>]
This would result in the following 3 files:
001 Ace Foods Pages 1 through 3.indd 002 Ace Foods Page 4.indd 003 Ace Foods Pages 5 through 10.indd
Because the 002 file has only a single page (page 4), the “s” after the word “Page” is omitted, as is the entire phrase “through <lp>”, since these were placed inside square brackets.
Section Marker <sm>
Use the <sm> code to insert the contents of the first section marker of the extracted file. (Note: InDesign has two similar fields in the Numbering and Sections window: Section Marker, and Section Prefix. They serve a slightly different purpose. The <sm> code picks up the Section Marker field, not the Section Prefix field!)
Alternate Layout Name <alt>
Use the <alt> code to insert the name of the alternate layout of the extracted file.
Paragraph Style <p:styleName>
Here’s where things start getting really powerful!
What the <p:styleName> tag does, is search each extracted file for the paragraph style specified (replace ‘styleName’ with the name of the desired paragraph style).
The text of the first such paragraph that is found in the extracted file will be inserted where the tag is.
Note: Any characters in the paragraph that are invalid for use as part of a filename will be stripped out of the result.
For example, let’s say we are preparing business cards for the 3 employees of the Ace Food company. We have an InDesign file with 3 pages of cards, one per employee (Mark Smith, Sue Lee, and Joe Levy).
The cards are set up in InDesign so that the employee name has the paragraph style “NameLine” applied to it in each of the three cards.
We now want to split this InDesign file into 3 smaller files, one file per business card, and we want the name of each file to be the name of the employee whose business card it is.
In such a case, typing the following in the Custom field
<p:NameLine>
will result in the following 3 files:
Mark Smith.indd Sue Lee.indd Joe Levy.indd
Of course, it is possible to use multiple paragraph styles as well.
If, for example, we also want to include the employee’s role (which appears on each business card, and has the paragraph style “JobLine” applied to it), we could type:
<p:NameLine> <p:JobLine>
and the 3 files would then be called
Mark Smith CEO.indd Sue Lee VP.indd Joe Levy Food Specialist.indd
Character Style <c:styleName>
The <c:styleName> tag searches each extracted file for the character style specified (replace ‘styleName’ with the name of the desired character style).
For details, see the explanation for the <p:styleName> tag, above, as this tag is identical to that one, except that it uses character styles instead of paragraph styles.
Grep Search <g:searchName>
This is the last, and perhaps the most powerful, of all the building blocks so far.
GREP is an advanced InDesign feature, and if you are not familiar with GREP it is well worth reading up on! However, It is outside the scope of this page to go into the intricacies of GREP, so I am presuming that you are familiar with how to use GREP in InDesign to create a powerful filtered search phrase.
InDesign lets the user save GREP searches for reuse later. All that is needed is to click on the little disc icon in the GREP search window, and type in a name.
This is where the fun begins! You can use one or more GREP searches created previously in InDesign with Extract Pages’ custom naming feature to create a really powerful naming structure!
To do this, use the <g:searchName> tag, and replace “searchName” with the name of your saved GREP expression.
For instance, let’s say you have previously saved a GREP search that finds all underlined text that has the “Address” paragraph style applied to it (presuming you have an “Address” paragraph style in the document, of course). You saved this GREP and called it “FindUnderlinedAddress”.
To use this GREP search with Extract Pages, just type:
<g:FindUnderlinedAddress>
Extract Pages will search each extracted document for the first result of this GREP search, and use it as the file name for that extracted file.
Note: This GREP search code cannot be used to change what is found. Only the “Find” part of the query is used. The “Change” part of the query is ignored.
Mix and Match
All the above codes can be used multiple times to create a complex file-naming scheme. For example, typing the following into the Custom field:
### <c:Title> <p:LastName> <g:FirstThreeLettersOfFirstName> <p:CompanyName> Page[s] <fp>[-<lp]
might result in the following file names (of course, this very much depends on the details of the results of the GREP search and contents of the paragraph and character styles for each file in question):
001 Mr Smith Mar Ace Foods Inc Pages 3-10.indd 002 Mrs Sue Lee Top Foods Page 9.indd etc. etc.
Errors
If the custom naming scheme results in a filename that cannot be used by the operating system, Extract Pages will silently save that file with the default naming scheme.
Questions and Comments
Having difficulty putting together the right naming scheme? Post a comment below and we’ll be glad to try and help!
Hailey
August 27, 2024 5:25 pmI’m trying to export newspaper pages as separate indd files. I can get the first 12 pages fine (A 1, A 2, etc), but I need to export pages 13-24 as B 1, B 2 etc. Any ideas how to do that?
Ariel
August 27, 2024 6:13 pmHi Hailey,
There are several ways, depending on how your file is set up.
I think some screenshots might help, which can’t be uploaded here in the comment section.
Could you repost your question in the Forum (https://forum.id-extras.com/) and we’ll take it from there?
Try to explain how the page numbering is currently set up in your existing InDesign file. Are the pages called B1 and B2 etc. in the ID file? How did you do that? Did you use sections and section markers? etc.
And perhaps include a screenshot of your page number in InDesign (showing hidden characters) as well as a screenshot of your Numbering and Section options (accessible from the Pages panel) so we can see what’s going on there as well.
Thanks,
Ariel
stefan
April 3, 2024 11:58 amHello,
is it possible to split an multiple page Indesign document in double page documents.
e.g.
we have 10 pages in on indesign document and want to split the document in 5 documents with double pages and save as 5 documents
thanks
stefan
Ariel
April 3, 2024 12:01 pmHi Stefan,
If I’ve understood correctly, you have a 10 page document, and you want to produce 5 separate docs from it: (1) 1-2.indd, (2) 3-4.indd … (5) 9-10.indd?
If so, then yes, certainly, Extract Pages can do that (with very flexible file-naming options).
Ariel
Frank
September 5, 2023 3:09 pmHi! I would like to export al pages to individual pdfs and attaching always page 1 of the indd-file to it. So is it possible to export with a schema like p2 + p1, p3 + p1, p4 + p1, … ?
Thanks,
Frank
Ariel
September 5, 2023 10:46 pmHi Frank,
Yes, absolutely.
In Extract Pages, in the Range field, type: 2,1; 3,1; 4,1; … etc. (You may want to use Excel or something to create the list of numbers you need.)
Make sure to select the option “Extract as Groups of Pages”.
I think that should work.
Ariel
Warren Mayall
August 17, 2021 1:00 amHi Arial,
Am I able to use “Extract Pages” triggered by a button in a PDF. There are 10 pages in the PDF.
I have a form that has many form fields each page. If a customer completes the form fields on a page but then needs to complete a new page I want a button he can press that will give him a copy of just that page. He would then complete this page and send it in as an addendum to the first pages.
Cheers
Warren
Ariel
August 17, 2021 10:59 amHi Warran,
Extract Pages is made to extract pages from an InDesign file (it can create PDFs, .indd, jpgs, etc. – but all based on an InDesign file) only.
You’re looking for some kind of a button in an interactive PDF that will save each page of the PDF as a separate file. I think it may well be possible to add a custom on-click event to a button in Acrobat that will do this, but it’s not something that you’d do with Extract Pages.
Ariel
Roy
May 19, 2021 10:01 pmHi Arial,
Another request. I format a lot of books and it would be handy to include the page count in the file name, aids in creating proper spine width. Problem is, the command seems to use the page number of the last section (10 pre-pages [i–x] plus 141 body pages [1–141]) and the filename appends 141, but I need the absolute page number, which is 151. Any chance of looking into adding the ability to choose which is wanted?
Thank you
Ariel
August 17, 2021 11:00 amHi Roy,
Good suggestion to add an “absolute page numbering” shortcode as well. I’ll think about it for the next upgrade.
Thanks,
Ariel
Michael Bann
April 28, 2021 1:19 amAriel, I went to that link, entered my email and the link sent to me is for version 1.7.3
Not 1.7.4
Ariel
April 28, 2021 1:21 amHi Michael: It does look like it, but in fact if you unzip the package you’ll see it’s 1.7.4.
Michael Bann
April 21, 2021 1:08 pmAriel,
I just purchased a license on March 20 2021
The download link I was sent was for version 1.7.3
Where might I get 1.7.4 ?
Cheers