Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
You might be better posting in the Acrobat forum.
Copy link to clipboard
Copied
But I need to do it using InDesign app only. Using CEP extension. Not using Acrobat.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
I am using this setting to export all pages: app.pdfExportPreferences.pageRange = "All";
Problem is that the order of execution is not in sync. PDF is getting exported before SmartTextReflow loads all pages of Word doc.
Copy link to clipboard
Copied
Ok. Then disable SmartTextReflow and add pages and frames until the story will not overflow.
Only then export to PDF.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Word- go Print/choose pdf.
Copy link to clipboard
Copied
>>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.
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Or do a Save As...
Copy link to clipboard
Copied
"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 )
Copy link to clipboard
Copied
Oops. Just noticed that this thread is from November 2021…
Regards,
Uwe Laubender
( Adobe Community Professional )