Skip to main content
Participant
November 12, 2013
Question

Script to batch export multiple Books (.indb) to PDF

  • November 12, 2013
  • 1 reply
  • 1530 views

I have multiple InDesign Book files that I would like to batch export to PDFs, respectively. (Not looking to combine multiple books into a single PDF. Just a 1 to 1 PDF export for each Book file.)

In googling for an answer, I found Peter Kahrel's script for doing just this for other InDesign files, but it does not work for Books. http://www.kahrel.plus.com/indesign/batch_convert.html

Does anyone know of a solution (paid or otherwise) for this process?  Opening up each Book and exporting to PDF from the ID menu takes quite a bit of time when doing this for several dozen files.

Looking forward to any discussion to come up with a solution if one can be found... Mr. Kahrel's javascript file is a binary js file, so it can't be modified as is, and other solutions I've found around the web don't clearly state that they work with Book files or not.

This topic has been closed for replies.

1 reply

Inspiring
November 13, 2013

try below code

before run script close all indb file

var fileFilters = "InDesign:*.indb*";

var myFolder = Folder.selectDialog ("choose Folder", fileFilters, false);

var files = myFolder.getFiles("*.indb");

for(i = 0; i < files.length; i++)

    {

       var theDocument = app.open(File(files), true);

         with ( theDocument ) {

            alert ( theDocument.name)

             exportPdf(theDocument)

                }

   }

function exportPdf(theDocument)

{

      myFilePath = myFolder + "/" +  theDocument.name + "_" + ".pdf";

        myFile = new File(myFilePath);

          theDocument.exportFile(ExportFormat.pdfType, myFile, false, app.pdfExportPresets.item('[Smallest File Size]'));

theDocument.close(SaveOptions.no)

}