Skip to main content
Inspiring
July 18, 2014
Question

export pdf per two pages

  • July 18, 2014
  • 1 reply
  • 543 views

Hey all,

I need to export to pdf in 2-page-increments

I found a somewhat similar script here in the forum but can't get it to work. Must be an error somewhere

Would someone please check and correct this for InD CC2014?

Thanks so much.

// Output PDF pages per 2 pages.  //

var SectionLength = 2;

for (var p=0; p<app.activeDocument.pages.length; p += SectionLength)

{

     with(app.pdfExportPreferences)

     {

          if (p+SectionLength-1 > app.activeDocument.pages.length)

               pageRange = app.activeDocument.pages

.name+"-"+app.activeDocument.pages[app.activeDocument.pages.length-1].name;

          else

               pageRange = app.activeDocument.pages

.name+"-"+app.activeDocument.pages[p+SectionLength-1].name;

          theFile = new File(pageRange+".pdf");

          app.activeDocument.exportFile (ExportFormat.pdfType, theFile, false);

     }

}

This topic has been closed for replies.

1 reply

Jongware
Community Expert
Community Expert
July 18, 2014

Can you define "can't get it to work"? There are too many possible reasons (for example, maybe you don't know how to save a script). The same goes for "Must be an error" -- if you get an error message, please tell what the error is, and the line it reports.

040767Author
Inspiring
July 18, 2014

Hey Jongware,

thanks for your fast response.

In my ExtendScript Toolkit I get the message "undefined is not an object" on line 3 when running with ExtendScript Toolkit CC

Maybe I don't know how to save a script, if there is more to it, than saving it in the right location?

Maybe I made a mistake upon cleaning up your provided script.

Existing script to export PDFs and Package INDDs in 32-page increments?


Jump_Over
Legend
July 18, 2014

Hi,

For me, it looks like you did not choose a target application (left-up dropdown list in ESTK) so your code do not recognize activeDocument.pages object

As Jongware said - reasons are hiding everywhere...

Jarek