Export Different Pages as Spreads, Possible?

I want to impose my document in code however I notice I can’t even do it manually. For example when I specify something like “3,30” in page range in the Export PDF Dialog settings, it exports two specific pages as a spread instead specifically pages “2,3”. Is there a way to export individual pages as spreads from Indesign to pdf or it just doesn’t work that way?

The code that I have which works for the most part but again doesn’t export individual pages as spreads

for (let index = 0; index < app.activeDocument.pages.length / 2; index++) {
  const pageCount = app.activeDocument.pages.length
  const pagesToExport = `${pageCount - (pageCount - index - 1)}, ${pageCount - index}`
  app.pdfExportPreferences.pageRange = pagesToExport
  app.pdfExportPreferences.exportReaderSpreads = true
  app.pdfExportPreferences.exportAsSinglePages = true  
  app.pdfExportPreferences.optimizePDF = true
  app.pdfExportPreferences.viewPDF = false
  app.activeDocument.exportFile(ExportFormat.PDF_TYPE, `C:\\Users\\blaah\\OneDrive\\Documents\\fall 2023\\imposition\\test${index}.pdf`, false)
}

@oiver55 I believe you would need to set each page’s Numbering & Section Options to force the page number, and then you could set the shuffling options (so you can get them to sit side by side), and then you could move the pages to printer spreads. Then, you would be able to make a spread of 32, 1, 2, 31, 30, 3, etc.

jsw

Dynamite, okay I’ll give it a shot

Perfect I got it working now, thanks much!

Excellent @oiver55 !