Skip to main content
Known Participant
November 15, 2021
Question

Converting Word to PDF

  • November 15, 2021
  • 6 replies
  • 1077 views

Hi,

I have a Word document having approx 10 pages. And I use smartTextReflow to load all the pages and then I want to export the entire document as PDF.

But only first page is getting exported before in the CEP script the export command gets executed before SmartTextReflow loads all the Word pages. Please help how to sync this.

Following is the code:

var tempDoc = app.documents.add();
var myPDFPage;
tempDoc.documentPreferences.facingPages = false;
tempDoc.documentPreferences.createPrimaryTextFrame = true;
var leftMargin = tempDoc.pages.item(0).marginPreferences.left;
var topMargin = tempDoc.pages.item(0).marginPreferences.top;
var myTextFrameTemp = tempDoc.pages.item(0).textFrames.firstItem();
myTextFrameTemp.geometricBounds = [leftMargin, topMargin, myDocument.documentPreferences.pageHeight - topMargin, myDocument.documentPreferences.pageWidth - leftMargin];
myPDFPage = myTextFrameTemp.place(File(myPDFFile), false)[0];
app.pdfExportPreferences.pageRange = "All";
tempDoc.exportFile(ExportFormat.PDF_TYPE, File(myPDFFile + ".pdf"), false);

This topic has been closed for replies.

6 replies

Community Expert
June 11, 2022

"But only first page is getting exported before in the CEP script the export command gets executed before SmartTextReflow loads all the Word pages. Please help how to sync this."

 

Well, do not use smart text reflow.

Add pages and also text frames if necessary and thread them by assigning values for nextPage or previousPage of the text frame as you go. recompose() the story and check for story.overflows.

 

Also note, that there could be circumstances in the Word file where you run in permanent overflow.

Look up some discussions here at the InDesign user forum where we discussed exactly this some years ago.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Community Expert
June 11, 2022

Oops. Just noticed that this thread is from November 2021…

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Jumpenjax
Community Expert
Community Expert
June 10, 2022

Converting word to pdf, go print choose print to pdf. Should be a drop down menu in the bottom left corner that says pdf. You can choose how you would like the pdf saved.

Lee- Graphic Designer, Print Specialist, Photographer
Dave Creamer of IDEAS
Community Expert
Community Expert
June 10, 2022

Or do a Save As...

David Creamer: Community Expert (ACI and ACE 1995-2023)
SumitKumar
Inspiring
December 29, 2021

Hi @SVIDdev ,

 

I have added recompose() method after placement of word doc file.

 

var tempDoc = app.documents.add();
var myPDFPage;
tempDoc.documentPreferences.facingPages = false;
tempDoc.documentPreferences.createPrimaryTextFrame = true;
var leftMargin = tempDoc.pages.item(0).marginPreferences.left;
var topMargin = tempDoc.pages.item(0).marginPreferences.top;
var myTextFrameTemp = tempDoc.pages.item(0).textFrames.firstItem();
myTextFrameTemp.geometricBounds = [leftMargin, topMargin, myDocument.documentPreferences.pageHeight - topMargin, myDocument.documentPreferences.pageWidth - leftMargin];
myPDFPage = myTextFrameTemp.place(File(myPDFFile), false)[0];
tempDoc.recompose();
app.pdfExportPreferences.pageRange = "All";
tempDoc.exportFile(ExportFormat.PDF_TYPE, File(myPDFFile + ".pdf"), false);

  

-Sumit
Jumpenjax
Community Expert
Community Expert
December 29, 2021

Word- go Print/choose pdf.

Lee- Graphic Designer, Print Specialist, Photographer
Dave Creamer of IDEAS
Community Expert
Community Expert
December 29, 2021

>>Word- go Print/choose pdf.

If you are referring to creating the PDF from Word, simply do a Save As. You don't need Acrobat--Office apps have been able to save to PDF since version 2007.

David Creamer: Community Expert (ACI and ACE 1995-2023)
Community Expert
November 15, 2021

Ok. Then disable SmartTextReflow and add pages and frames until the story will not overflow.

Only then export to PDF.

 

Regards,
Uwe Laubender

( ACP )

Derek Cross
Community Expert
Community Expert
November 15, 2021

You might be better posting in the Acrobat forum.

SVIDdevAuthor
Known Participant
November 15, 2021

But I need to do it using InDesign app only. Using CEP extension. Not using Acrobat.

Derek Cross
Community Expert
Community Expert
November 15, 2021

So you are Placing a Word file into InDesign and exporting the resulting document to PDF – have you tried just using one of InDesign's Adobe PDF Presets?