Prerequisite knowledge
 
Adobe InDesign Folio Builder panel and Folio Producer tools
 
Get the latest Folio Builder panel and Folio Producer tools from the Digital Publishing Suite dashboard.
 
User level: All
 
Original publication date: 02/28/2012
 
Modified: 12/06/2013 (Change log)
 
Required products
 
Sample files
 
By downloading software from the Adobe Web site you agree to the terms of our license agreement. Please read it before downloading.
 

 

Note: If you have questions about this article, use the DPS forum. Please don’t contact technical support with questions about Adobe Developer Connection articles.

 

Many publishers have vast libraries of publications in PDF file format and would like a quick way to turn these into basic Adobe ® Digital Publishing Suite folios. This tutorial article shows you how to use a sample Adobe InDesign script that automates the process of converting PDF files into InDesign files that are easy to import into Folio Producer. The resulting folios are ready for publication as a Digital Publishing Suite application, including both portrait and landscape orientations.
 

 
What does the sample script do?

Derek Lu, an Adobe Digital Publishing Suite Architect, created the sample script, create_indd.jsx, which is an InDesign script written in JavaScript. The script performs the following actions when you run it:
 
  1. The script processes a directory that contains an entire issue of PDF files, including covers.
  2. The script creates INDD files and the associated sidecar.xml metadata file. You can bulk-import the resulting files into the Folio Builder panel of InDesign easily, creating a folio containing portrait and landscape layouts for the entire issue.
Note: This script creates a very specific type of folio. If your needs are different, you might have a JavaScript developer modify the script for your specific needs or create a new script from scratch using the sample script as a starting point.
 
The following list includes some important details about how the script in this article works:
 
  1. By default, the script will create only portrait pages. You can change this behavior by modifying the ORIENTATION parameter on line 3 of the script. The script can be modified to create only landscape pages, or both orientations. To do this, open create_indd.jsx in a text editor, and change “portrait” to either “landscape” or “both”. If you want to make your content available on tablet devices in both orientations, select “both”. If you want to provide the best viewing experience in the web viewer, you could consider running the script on your PDF file twice, once for “both” and once again for “portrait”. Then, within Folio Producer you can mark the portrait version of your folio as the “Web-only Rendition” so it will be delivered to the web viewer readers instead of the dual-orientation folio.
  2. In the landscape layout, two pages from your original PDF files are positioned side-by-side in one page of an INDD file. In the portrait layout, each page is on its own page of an INDD file. The exception is the front and back covers:
    1. In landscape orientation, the front cover is on the right side on an INDD page and the back cover is on the left side of a page.
    2. In the portrait orientation, the INDD files for the covers contain only one page each.
    3. See examples of how the resulting folio looks on an iPad in Figures 1 and 2. In this article, you will follow steps to run the script on sample content so that you can understand what to expect.
  3. Depending on the aspect ratio of your source PDF files, the content stretches to fill or scale proportionately, with letterboxing where necessary.
  4. The script assumes that each PDF file has a crop box, which the script uses to determine how to place the PDF file in the INDD document.
  5. Your input content must be a directory that contains single-page PDF files and follow a naming convention described in the Preparing your PDF files section.
  6. The resulting folio displays as flattened stacks. The user will navigate the folio horizontally only, from page-to-page.
  7. The script as written targets the iPad 1 or 2 with a resolution of 1024x768. You can change these settings by editing the script file in a text editor.

 

Figure 1: Browsing a folio created with the script on an iPad in portrait orientation
Figure 1: Browsing a folio created with the script on an iPad in portrait orientation
 
 
Figure 2: Viewing two side-by-side pages of a folio created with the script on an iPad in landscape orientation
Figure 2: Viewing two side-by-side pages of a folio created with the script on an iPad in landscape orientation
 
 
Check out the following commercially published folios that some developers in the community created using a script, such as the following examples from Source Interlink Media LLC:
 

 
Installing the sample InDesign script

Use the following steps to install the sample InDesign script, create_indd.jsx, which you downloaded at the beginning of this article in the Requirements section:
 
  1. Find the Adobe InDesign CS5.X\Scripts\Scripts Panel folder. If the Scripts\Scripts Panel folders do not exist, create the "Scripts" folder and the "Scripts Panel" folder within the "InDesign" folder.
  2. Put the unzipped JSX file, create_indd.jsx, within the Adobe InDesign CS5.X\Scripts\Scripts Panel folder. Once the script is in the folder, it appears on the Scripts panel inside the InDesign application.
  3. To display the panel in the InDesign application, select Window > Utilities > Scripts. On Macintosh, right-click one of the scripts folders in the Scripts panel and select "Reveal in Finder" option, making it easy to quickly find the folder.
  4. Simply drag and drop the script into the Adobe InDesign CS5.X\Scripts\Scripts Panel folder to install it.
You can use these steps to install any INDD script. Now that you've installed the sample script for this article, use the following steps to try it out with sample files.
 

 
Preparing your PDF files

Before running the script, you must prepare your input PDF files. The script requires one PDF file per page in your document, which is exactly four cover pages and an even number of body pages, as follows:
 
  • Front Cover page
  • Inside Front Cover page
  • Even number of body pages
  • Inside Back Cover Page
  • Back Cover Page
Use the following steps to prepare your input PDF files.
 
  1. Create a new folder.
  2. Convert your document into individual PDF files – one page per file. You might accomplish this, for example, in Adobe Acrobat, by using the "Extract Pages…" option in the Page Thumbnails panel. Be sure to select the "Extract Pages As Separate Files" option.
  3. Place all new PDF files into your new folder.
  4. You may need to rename your files. The script requires that the files are in a folder in the following alphabetical order:
  • Body pages first, followed by the four cover pages:
  • Front Cover
  • Inside Front Cover
  • Inside Back Cover
  • Back Cover
You can rename the files using any naming convention you like, as long as the files follow the alphabetical order specified above. The following is a naming convention that we suggest:
 
Body pages: P###_PUBP-ISSUE#.pdf, where:
 
  • ### is the page number
  • PUBP is the Publication Code
  • ISSUE# is the Issue Number, in either YYMM00 or YY00## format
For instance, page 3 of the March 2012 issue of "TEST" magazine would be: P003_TEST-120300.pdf
 
Cover pages: In renaming cover pages, use the same considerations as for the body pages, but start the file name with the following naming conventions:
 
  • "PCN1" for the Front Cover
  • "PCV2" for Inside Front Cover
  • "PCV3" for Inside Back Cover
  • "PCV4" for Back Cover
For example, the sample files provided in this article are as follows, in alphabetical order:
 
P003_TEST-120300.pdf (Body Page 3) P004_TEST-120300.pdf (Body Page 4) P005_TEST-120300.pdf (Body Page 5) P006_TEST-120300.pdf (Body Page 6) P007_TEST-120300.pdf (Body Page 7) P008_TEST-120300.pdf (Body Page 8) PCN1_TEST-120300.pdf (Front Cover) PCV2_TEST-120300.pdf (Inside Front Cover) PCV3_TEST-120300.pdf (Inside Back Cover) PCV4_TEST-120300.pdf (Back Cover)
  1. Go ahead and download the ZIP file from the Requirements section at the beginning of this article, which contains the sample PDF files for this article. Unzip the files into a folder.
In the next section, you'll learn how to run the script against these sample files to create InDesign files.
 

 
Running the script to create InDesign files

Before you run the script to create InDesign files, ensure that there is no folder present within your folder of PDF files called "forImport," because the script creates the "forImport" folder when you run it. Follow the steps below to run the script:
 
  1. Open InDesign.
  2. Display the Scripts panel (select Window > Utilities > Scripts).
  3. In the Scripts panel, double-click the script name (create_indd.jsx).
Figure 3: The InDesign Scripts panel with the create_indd.jsx script installed
Figure 3: The InDesign Scripts panel with the create_indd.jsx script installed
 
 
  1. Once you double-click the "create_indd.jsx" script, InDesign displays a dialog box for you to select the folder with your PDF files. Navigate to and select the folder where you unzipped your sample PDF files.
Behind the scenes, InDesign runs the script and processes your PDF files into a series of INDD files and a sidecar.xml file. You can see the output of the script in a folder called "forImport" that the script creates within the folder that contained your source PDF files.
 
For the sample PDF files, the output is six folders, which contain the horizontal and vertical INDD files, with typically two pages per file. Each of these folders will be an "article" in Folio Builder, but they will all combine to form a seamless folio. In the next section, you will import these InDesign files into Folio builder to create a Digital Publishing Suite folio.
 

 
Importing the InDesign files into Folio Builder and previewing the resulting folio

To create a Digital Publishing Suite folio from the output of the script, use the Folio Builder's "import" capability.
 
  1. In InDesign, open the Folio Builder panel (Window > Extensions > Folio Builder).
  2. Click "New" at the bottom of the Folio Builder panel window to create a new folio.
  3. In the New Folio dialog box:
  • Enter a folio name.
  • Choose the size. You must select 1024x768 for this default script, which corresponds to the iPad 1 or 2.
  • Select the "Automatic" option for the Default Image Format.
  1. Note: This setting converts the PDF files to images in the folio and allows you to preview the results in Adobe Desktop Content Viewer, however, this also creates large folio files, which do not support the pinch-to-zoom feature.
  2. Alternatively, you can select the "PDF" option for the Default Image Format. This option will create a smaller folio file, and allows your users to be able to zoom on your folio via double-tap or pinch-to-zoom features on iPad. However, you will not be able to preview the folio in the Desktop Content Viewer because it does not yet support PDF stacks. Instead, you will need to either publish it via Folio Producer and preview it on a tablet using the Adobe Content Viewer application, or use the "USB Previewing" feature to preview it directly on a tablet connected via USB. Read more about this in Colin Fleming's article, Self-Signed Adobe Content Viewer: How-To.)
Click OK.
 
Figure 4: Specifying settings in the New Folio dialog box
Figure 4: Specifying settings in the New Folio dialog box
 
 
  1. Click the small menu button in the upper right side of the Folio Builder panel and select "Import…"
Figure 5: Importing into Folio Builder
Figure 5: Importing into Folio Builder
 
 
  1. In the "Import Article" dialog box, select the "Import Multiple Articles" option.
  2. Click the small folder icon next to "Location:" to navigate to and select the "forImport" folder that the script created within your folder of PDF files (Figure 6).
Figure 6: Import Article dialog box
Figure 6: Import Article dialog box
 
 
  1. Folio producer imports the InDesign files and creates multiple articles that flow together to recreate your original document. See figure 7 for the list of articles created from the sample files:
Figure 7: Resulting articles in folio after importing the output of the sample files run through the script
Figure 7: Resulting articles in folio after importing the output of the sample files run through the script
 
  1. Click the back button in the upper left corner of the Folio Builder panel to return to the list of all folios.
  • Ensure that you highlight your new folio in the Folio Builder panel and click the "Preview" option in the lower left corner of the Folio Builder panel.
  • Select "Preview on desktop." This launches the Adobe Desktop Content Viewer so that you can preview your content. Note: As mentioned earlier, the current Desktop Viewer does not support PDF stacks. As such, you will see an error if you set the image format of the folio to the PDF option.
Figure 8: Previewing your folio in the Desktop Content Viewer
Figure 8: Previewing your folio in the Desktop Content Viewer
 
 
  1. Preview your folio in the desktop content viewer.
    Note: The document appears as "flattened stacks" that users browse horizontally. In this layout, two pages display side-by-side in landscape orientation, while one page displays at a time when in portrait orientation. Press Ctrl/Command-r to rotate the orientation of the desktop content viewer.
You can also use the online Folio Producer organizer to publish the folio and test it on a device such as an iPad. Alternatively, read Colin Fleming's article, Self-Signed Adobe Content Viewer: How-To to learn about using USB to preview directly on an iPad without uploading to and publishing from Folio Producer. Either method of previewing directly on a device allows you to view folios created with the default image format set to the PDF option.
 

 
Where to go from here

This article has shown you how to use a sample script to transform PDF documents into basic Adobe Digital Publishing Suite folios. Depending on your specific needs, you may need to modify the script. One simple modification of the script would be to change the target resolution of the folios to a different size other than 1024x768 for the iPad 1 and 2. See the comments within the script for guidance on this as well as other details.
 
For more information on Previewing Folios and Articles, see the Help documentation for Using Digital Publishing Suite.
 
Comments are currently closed as we migrate to a new commenting system. In the interim, please provide any feedback using our feedback form. Thank you for your patience.
 
Change log
 
12/3/13: Updated script to allow user to force either portrait or landscape orientation, or allow both.