Skip to main content
platm72
Inspiring
December 1, 2018
Question

How to export pages as a spread in PDF ?

  • December 1, 2018
  • 3 replies
  • 1946 views

Hello,

I'm trying to export my document spreads to a PDF file as a spread using below code:

app.pdfExportPreferences.exportReaderSpreads = true;

but Indesign completly ignores setting the property, and saves a single paged PDF !!

I'm wondering, where is the catch ... 🙂 ?

Thanks  in advance for any help or suggestion.

Regards,

Marcin

This topic has been closed for replies.

3 replies

Peter Kahrel
Community Expert
Community Expert
December 2, 2018

This works for me:

app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;

app.pdfExportPreferences.exportReaderSpreads = true;

myPdf = File (...)

app.documents[0].exportFile (ExportFormat.PDF_TYPE, myPdf);

Maybe try adding line 1 to your code.

There is something wrong with PDF export though: usually when you set the export settings with a script, those settings are sticky in that you see them when you next manually export an indd to pdf. But the 'Export as spreads' button isn't selected after setting it. Another way to see that is by using this line instead of line 4:

app.documents[0].exportFile (ExportFormat.PDF_TYPE, myPdf, true);

This opens the PDF Export dialog and 'Spreads' should have been selected, but it isn't. But as I mentioned, spread export does work over here.

P.

platm72
platm72Author
Inspiring
December 2, 2018

Hi everybody :-)

thank you for your attention and all the advise !!

Thank them I understood where I am making a mistake !

My script exports PDF using this code:

doc.exportFile( ExportFormat.pdfType, pdfFile, false, selectedPDFPreset );

so, the selectedPDFpreset overrides the application property exportReaderSpreads.

It is so obvious .... now :-)

Thank you again and excuse me my misunderstanding of the problem origin.

BTW: what is the practical diference between exportFile and asynchronousExportFile method ?

Best regards

Marcin

platm72
platm72Author
Inspiring
December 2, 2018

I've changed my method. Now the method looks for property  exportReaderSpreads of pdfExportPreset insted of pdfExportPreference and it works perfect :-)

Thanks again :-)

Regards

Marcin

Community Expert
December 2, 2018

Hi Marcin,

Works fine for me, can you share the code that you are using and InDesign version that you are using. I tried on CC2017 MAC and it worked.

-Manan

-Manan
payalm68947498
Inspiring
December 2, 2018

Hi platm,

     just try in another way, may it works,

var myDoc = app.documents[0];

var FilePath = "Your File Saving Path";

with(app.pdfExportPreferences){

      exportReaderSpreads = true;

}

myDoc.exportFile(ExportFormat.PDF_TYPE, File(FilePath+"/PrintPDF.pdf"), false);