Skip to main content
New Participant
September 15, 2023
Question

Exporting only odd page number from Indesign

  • September 15, 2023
  • 4 replies
  • 2226 views

Hi everyone,

is there any possibility to export only the odd page numbers or only the even page numbers in InDesign?
I guess this should be possible, because it works in the print dialog. Perhaps it needs only typing a special character combination in the dialog box?
Thanks in advance
Matthias

This topic has been closed for replies.

4 replies

Adobe Expert
September 15, 2023

You can use formula in Excel to convert numbers to letters, etc. 

 

But page 'numbers' can include section prefixes, so you can have page numbers/folios such as 'A12' or '27-C'.

FRIdNGE
Inspiring
September 15, 2023

Other formulation:

 

// _FRIdNGE-0023b_ExportOddEvenPagesToPDF.jsx
// Export To PDF on Desktop
var myPDFExportPreset = app.pdfExportPresets.item('xxx');
//-------------------------------------------------------------------------------
/* 0 = even (paires) pages / 1 = odd (impaires) pages */ var myOdd_Even = 0;
if ( myOdd_Even == 0 ) {
    var mySide = PageSideOptions.LEFT_HAND;
    var myPDFfile = new File('~/Desktop/EvenPages.pdf');
} else {
    var mySide = PageSideOptions.RIGHT_HAND;
    var myPDFfile = new File('~/Desktop/OddPages.pdf');
}
//-------------------------------------------------------------------------------
var myDoc = app.activeDocument,
myAllPages = myDoc.pages,
myPages = [];
for ( var p = 0; p < myAllPages.length; p++ ) if ( myAllPages[p].side === mySide ) myPages.push(myAllPages[p].name);
app.pdfExportPreferences.pageRange = myPages.join(",");
myDoc.exportFile(ExportFormat.pdfType, myPDFfile, false, myPDFExportPreset);

alert( "Done! …" )

 

(^/)

New Participant
October 2, 2023

Sorry for answering lately, but I was on vacation.
I've tested the script and it works excellent for my needs. I combined the script for exporting the odd and even side together, which saves me one step.
Thank you all for your support.

Adobe Expert
September 15, 2023

James's idea to print to the PDF driver is interesting, but it won't let you select a preset or make any other adjustments. Uwe's idea of using a spreadsheet or some way to generate a list of odd or even numbers works only if the pages are numbered with plain Arabic numbers (and you need to know the document's extent). That leaves Barb's idea of a script, see below.

 

To use it, open the document you want to export and run the script. At the prompt, type odd or even and click OK. The script copies a string with page numbers (rectos or versos) to the clipboard.

 

Then export the document, and copy the page string into the 'Range:' field.

 

(Unfortunately it's not possible to pre-set or pre-fill the PDF export dialog, so the script plugs the string in a temporary text frame, copies its content, and removes it. Rather than removing the frame the script undoes its addition so that it leaves no footprint in the document.)

 

(function () {
  
  var reply = prompt ('Enter odd or even', 
    'odd', 'Print odd or even pages');
  if (!reply) {
    exit();
  }
  if (reply.toLowerCase() === 'odd') {
    start = 0;
  } else if (reply === 'even') {
    start = 1;
  } else {
    exit();
  }
      
  var s = '';
  var pp = app.activeDocument.pages.
    everyItem().getElements();
  for (var i = start; i < pp.length; i=i+2) {
    s += pp[i].name + ',';
  }
  var frame = app.activeDocument.textFrames.add ({
    contents: s.replace(/,$/,''),
  });
  frame.parentStory.paragraphs[0].select();
  app.copy();
  app.activeDocument.undo();
}());

 

James Gifford—NitroPress
Brainiac
September 15, 2023

James's idea to print to the PDF driver is interesting, but it won't let you select a preset or make any other adjustments.

 

I'd suggest only — and was thinking — that this kind of printing is probably not for demanding prepress, so plain-vanilla "printing" would probably serve many needs. Maybe not the OP's, though.

Barb Binder
Adobe Expert
September 15, 2023

Hi @Matthias N.:

 

Scripting extends InDesign's default functionality, but within the InDesign feature set, the only option to use Export to PDF is to type in the pages you want and separate them with a comma.

Range: 1,3,5,7,9,11 etc

 

Not very helpful for a long document unless you do it all the time, in which case you could type in once and  copy/paste that string from another file when you need it. 

 

~Barb

Adobe Expert
September 15, 2023

Hi Barb,

for numbers like that one could use Excel or OpenOffice Calc.

 

Simply type 1 in the first cell of a column, then add 3 in the cell of the same column below.

Expand the selection of the two cells downwards and Excel or Calc will generate consecutive odd numbers automatically.

Copy/paste the result to e.g. InDesign and change all paragraph signs to commas.

Copy/paste the result to the range field of the export dialog.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

James Gifford—NitroPress
Brainiac
September 15, 2023

Export (to PDF, at least) doesn't have an even-odd option. However, you can Print to the PDF driver and have the even or odd page output choices.