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

how to write a script for export to pedf interactive?

Explorer ,
Oct 17, 2022 Oct 17, 2022

hi, it exist lot of nice script for export to pdf but, i need to integrate it into my script

 

2 possiblity, i write it  into my actual big script after update all link by recusrion, we can export the "etiquette fini.indd" file

 

 

or i write a script with scan mask function for open only the "etiquette fini.indd" file name (name existing in 70 version file with 70 path different), and i export only this file to pdf interactive?

 

 

thanks for your help

 

i m so close to finish my job

TOPICS
Scripting
1.9K
Translate
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 ,
Oct 17, 2022 Oct 17, 2022

Exporting pdf is just a few lines of code, so I would suggest add it to your bigger script that does all the relinking and before closing the INDD file export the pdf as well

-Manan

Translate
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
Explorer ,
Oct 17, 2022 Oct 17, 2022

ok because pdf export can generate some crash it s maybe better to use this function separatly?

Translate
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 ,
Oct 17, 2022 Oct 17, 2022

Why would it crash? And if it does crash under some circumstance then it will crash even if you keep the PDF export code in a seperate file. I again suggest to you don't shift your focus to multiple goals. First target to create a workable script and then keep on adding error handling, doing refactoring etc as and when needed otherwise you will keep looking for alternatives

-Manan

Translate
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
Explorer ,
Oct 17, 2022 Oct 17, 2022

because before, i used native function export to pdf

if my file have just some page, it work

 

but i have try to export my catalogu, and it crash at 100% each time, i have do it with pdf interactive, and it work

 

support adobe have check during several day, and never find  the reason...

Translate
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 ,
Oct 17, 2022 Oct 17, 2022

Hi @laurence roussel12011930 ,

it may help to look into the code of Peter Kahrel's script Batch Process:

https://creativepro.com/files/kahrel/indesign/batch_convert.html

 

See also into DOM documentation:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#InteractivePDFExportPreference.html#d1e32...

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Translate
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
Explorer ,
Oct 17, 2022 Oct 17, 2022

ok, we can test name file, if we will close "étiquette finie.indd" we will export it to pdf

Translate
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
People's Champ ,
Oct 17, 2022 Oct 17, 2022

You may as well consider the sample from the official documentation (cf P55) : https://usermanual.wiki/adobe/InDesigncs6ScriptingJSEN.3768967468/view

 

Although the doc is CS6 old, the method didn't move much.

 

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

 

Exporting PDF with interactive featuresThe following script exports a document with interactive features as a PDF. (For the complete script, see ExportInteractivePDF.)//Given a document "myDocument," add page transitions...for(var myCounter = 0; myCounter < myDocument.spreads.length; myCounter++){myDocument.spreads.item(myCounter).pageTransitionType PageTransitionTypeOptions.wipeTransition;myDocument.spreads.item(myCounter).pageTransitionDirection =PageTransitionDirectionOptions.down;myDocument.spreads.item(myCounter).pageTransitionDuration =PageTransitionDurationOptions.medium;}app.interactivePDFExportPreferences.flipPages = true;app.interactivePDFExportPreferences.flipPagesSpeed = 5;app.interactivePDFExportPreferences.openInFullScreen = true;app.interactivePDFExportPreferences.interactivePDFInteractiveElementsOption =InteractivePDFInteractiveElementsOptions.includeAllMedia;//Export the document to PDF.myDocument.exportFile(ExportFormat.interactivePDF,File(Folder.desktop + "/InteractivePDF.pdf"), false);

 

 

we are right i can use this code because it s write:

(For the complete script, see
ExportInteractivePDF.)
 
 
we are agree than ExportInteractivePDF and Exporting PDF with interactive features  are same action?
Translate
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
People's Champ ,
Oct 19, 2022 Oct 19, 2022

There is a fundamental difference between exporting to interactive PDF and exporting to PDF. The first one intends to output PDFs for digital distribution (hence interactive as you may find hyperlinks and so on), typically images are dramatically downsized and color space is RGB. Export  to PDF is more print oriented. The two export format mimicks the capacity of the user to choose the PDF format (s)he wants to use.

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

sorry i don t ask if there is difference between pdf interactive and pdf for print i ask for 

ExportInteractivePDF and Exporting PDF with interactive features

 

because in your manual it s not clear for me

 

Exporting PDF with interactive featuresThe following script exports a document with interactive features as a PDF. (For the complete script, see ExportInteractivePDF.

 

i do not see ExportInteractivePDF into your maual

 

and about diffence pdf and pdf interactiv, i can t export my catalogu to pdf wihtout crash at 90%,and i can only with interactive

 

support adobe have search during 3 day with me for understand without never find solution...

Translate
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
People's Champ ,
Oct 19, 2022 Oct 19, 2022

Sorry if I misunderstood the need at the first place. Yes ExportInteractivePDF equals Exporting PDF with interactive features in the UI.

If you are facing crash with the regular PDF export, I would suggest that you do export to PDF manually but using page ranges until you can find the page (hopefully only one) that causes the crash and check on the page content what is the problem.

Crashes are not a typical behaviour but maybe something is preventing PDF creation like a font embedding licence issue, a corrupted graphic…Unless you can export to PDF manually without crash, I won't spend time at first investigating the script.

FWIW

Loic

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

i have do that, but it not determine wich page exactly, because, i have try to remove all link into this page (1 page = 1 link) and it was same problem

 

but with interactif there is not problem, 

 

now i need just to understand how to insert the good few line into my script for:

 

export with same name in same folder than "source", and overwrite if existing

 

and there is no problem for missunderstand, my english is really not clear...

Translate
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
People's Champ ,
Oct 19, 2022 Oct 19, 2022

Something you can do, call it the last chance operation is to export file to idml (manually), open this idml to get a brand new InDesign document and export to PDF again. If it does work, it may signify something was corrupted in your genuine document and that you got it fixed.

If it didn't, you need to isolate once again the source of the problem. If you do segmented pdf exports, you should eventually isolate the culprit.

If something is wrong with your file, you will never get it right with scripting.

The fact that it works with interactive is interesting tough. It might be a performance issue (full disks, network latencies while writing). Can you export to your file system (not network) and see if crash occurs?

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

we do that with adobe support

 

we have try all

Translate
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
People's Champ ,
Oct 19, 2022 Oct 19, 2022

Well, I have tried too here but there is something for sure. If you have a colleague, maybe you can ask him/her to export from his/her machine to see if problem persists.

Nothing better for now.

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

we have try with an other machine...  we have try to export assembly file, we have try idml, i have try range page..

suport adobe take control to my computer during 2 day....

they have download the file, and answer me they don t have problem to their side..... only on our network

 

 

pdf interactif is the alone solution....

Translate
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
People's Champ ,
Oct 19, 2022 Oct 19, 2022

See : "answer me they don t have problem to their side..... only on our network" That's why I asked for any network issues. If there are latencies in the network, InDesign may crash during I/O operations.

Try this : package your indesign document to a local folder (C:/… or ~/Documents) so every single resource is not on the network. Then open the local indd file and export.

Also be aware than antivirus can be a pain in the ass for I/O network operations. I have seen scripts widely slowed down for that.

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

impossible all my ressource are on net work

 

folder is too big for to be transfered

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

can you just try to explain me or help to me to adapt this few line for put into my script for export my document as interactive pdf?

 

it s my last step for finish this script

 

thanks in advance see you later

Translate
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
People's Champ ,
Oct 19, 2022 Oct 19, 2022

I gave you doc sample, it's basically copying/pasting from there.

Translate
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 ,
Oct 19, 2022 Oct 19, 2022

Hi @laurence roussel12011930,

The code that you picked up from the pdf shared by @Loic.Aigon is good enough to be used. The only things you need to edit are

  • Set the myDocument variable. I have set it in the first line by a reference to the currently active document, you may set it or just replace it with the document object reference you might have in your script.
  • The other change you need to make is in the last line to change the file path and file name of the exported pdf

 

var myDocument = app.documents[0]	//Or set it with or replace it with the document object you might have
for (var myCounter = 0; myCounter < myDocument.spreads.length; myCounter++) {
	myDocument.spreads.item(myCounter).pageTransitionType PageTransitionTypeOptions.wipeTransition;
	myDocument.spreads.item(myCounter).pageTransitionDirection = PageTransitionDirectionOptions.down;
	myDocument.spreads.item(myCounter).pageTransitionDuration = PageTransitionDurationOptions.medium;
}
app.interactivePDFExportPreferences.flipPages = true;
app.interactivePDFExportPreferences.flipPagesSpeed = 5;
app.interactivePDFExportPreferences.openInFullScreen = true;
app.interactivePDFExportPreferences.interactivePDFInteractiveElementsOption = InteractivePDFInteractiveElementsOptions.includeAllMedia;

myDocument.exportFile(ExportFormat.interactivePDF,File(Folder.desktop + "/InteractivePDF.pdf"), false);	//Change the file path and file name as needed

 

 -Manan

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

ok i do that

 

function exporttopdf(doc) {
var myDocument = app.activeDocument[0]	//Or set it with or replace it with the document object you might have
for (var myCounter = 0; myCounter < myDocument.spreads.length; myCounter++) {
	myDocument.spreads.item(myCounter).pageTransitionType PageTransitionTypeOptions.wipeTransition;
	myDocument.spreads.item(myCounter).pageTransitionDirection = PageTransitionDirectionOptions.down;
	myDocument.spreads.item(myCounter).pageTransitionDuration = PageTransitionDurationOptions.medium;
}
app.interactivePDFExportPreferences.flipPages = true;
app.interactivePDFExportPreferences.flipPagesSpeed = 5;
app.interactivePDFExportPreferences.openInFullScreen = true;
app.interactivePDFExportPreferences.interactivePDFInteractiveElementsOption = InteractivePDFInteractiveElementsOptions.includeAllMedia;

myDocument.exportFile(ExportFormat.interactivePDF,File(Folder.desktop + "/InteractivePDF.pdf"), false);	//Change the file path and file name as needed
}

 

 

just filepath, and name i don t know how to recuperate the same place than folder.doc.filePath and same name with pdf

 

and i call this function after openandupdate(doc)

 

i see into line, "flip page", but we are agree, it s not a flipbook like that:

https://fr.calameo.com/laboratoire-phykidis/read/0069039871ed71cc320d5

?

Translate
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
Explorer ,
Oct 19, 2022 Oct 19, 2022

nothing

Translate
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 ,
Oct 19, 2022 Oct 19, 2022

Try the following code. It will export the pdf in the same folder where the indd file is saved and save it with the name of indesign file. I have called the method for the currently active document, you can change the argument as needed according to your script

function exporttopdf(doc) {
for (var myCounter = 0; myCounter < doc.spreads.length; myCounter++) {
	doc.spreads.item(myCounter).pageTransitionType = PageTransitionTypeOptions.wipeTransition;
	doc.spreads.item(myCounter).pageTransitionDirection = PageTransitionDirectionOptions.down;
	doc.spreads.item(myCounter).pageTransitionDuration = PageTransitionDurationOptions.medium;
}
app.interactivePDFExportPreferences.flipPages = true;
app.interactivePDFExportPreferences.flipPagesSpeed = 5;
app.interactivePDFExportPreferences.interactivePDFInteractiveElementsOption = InteractivePDFInteractiveElementsOptions.includeAllMedia;

var fName = doc.name.replace(/\.indd/, ".pdf")
doc.exportFile(ExportFormat.interactivePDF, File(doc.filePath.fsName + "/" +  fName), false);
}

exporttopdf(app.documents[0])

Regarding the flip option, you should be able to comment those line and thing should work, try it once you have the export code working

-Manan

 

Translate
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