• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
7

Exporting only odd page number from Indesign

New Here ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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

TOPICS
How to , Import and export , Print , Scripting

Views

775

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.0 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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 )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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();
}());

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.0 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

… A very old (and basic) Code to export Odd or Even Pages to PDF written years ago when I was a beastly young scripter:

 

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

alert( "Done! …" )

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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'.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

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! …" )

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

Both scripts and the idea in general - getting names of the pages - are obvious and very clever at the same time.

 

I hope you won't mind if I'll use it in my ID-Tasker as a new Rule - but with much greater potential...

 

User will be able to find something - objects or texts and/or sort and filter by any text/object property - then this Rule will collect all names of the pages for print/export - with or without filtering duplicates - and user will be able to print/export pages in an alphabetical or numerical order - based on any property...

 

Should be very handy when doing DataMerge and when results are not initially in the desired order... Or for any other purpose.

 

My signature isn't just an empty slogan - and this forum is a gold mine for new ideas.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 02, 2023 Oct 02, 2023

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines