Skip to main content
Inspiring
November 5, 2022
Question

problem with export pdf function

  • November 5, 2022
  • 5 replies
  • 6736 views

hi every body, i have sometime (but not every time ) a problem on result to export pdf

 

main source is great, result have square...

 

and if i repeat my script it become ok (attached picture)

 

function exporttopdf() {
  var myDocument = app.activeDocument; //Or set it with or replace it with the document object you might have
  //if (myResult == true){
  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 = false;
  app.interactivePDFExportPreferences.interactivePDFInteractiveElementsOption =
    InteractivePDFInteractiveElementsOptions.includeAllMedia;
  var docName = myDocument.name.replace(/\.[^\.]+$/, "");
  var outputFolder = Folder(myDocument.filePath);
  var newFile = File(decodeURI(outputFolder) + "/" + docName + ".pdf");
  myDocument.exportFile(ExportFormat.interactivePDF, newFile, false); //Change the file path and file name as needed
  // }
}

 

This topic has been closed for replies.

5 replies

Inspiring
November 9, 2022

Try looking at the update links. I'm not a scripter, but I believe it will be related, because the script batch converter also makes these errors for me, and that's why I can't use it, because the resulting pdfs are not always 100% correct.

And I think that's why:
All the links are fine and they are in several documents that are in the book.
If you turn off "check links before document open" in the preferences the exported pdfs are often wrong. If it's on, the resulting pdfs are fine.

Inspiring
November 9, 2022

it s activate for me

but during script i ask no interaction level

Inspiring
November 11, 2022

please someone can help me???

 

we have clean and read read read the code, we don t understand why everyitem().update() not work correctly

we are out of network (sample into the link)

we work on indd 2022

all is ok

 

try to modify colour of text into ingredient.doc,and modify citron.ai

and look the result, and open file, no file are updated....

 

2 programmer have help me, and don t understand, it s too specific error at the api...

Inspiring
November 9, 2022

i can offer some clues to your original question in the other thread.
https://community.adobe.com/t5/indesign-discussions/what-is-difference-between-everyitem-update-update-relink/m-p/13327259#M501283

The reason why the links are still modified after the script is run is because somehow (internal_link[k].relink(internal_link[k].linkResourceURI);?) the script went into the "assemblage" folder and modified and saved these two files in the background:
    Assemblage_fond_couleur_filigrane - Copie (2).indd
    assemblage citron.indd
Since these two files are nested two level down from the catalogue.indd, all indd files above these two now have outdated links when you open the catalogue, ft100, and fiche produit files again.

Now this only happens with the files inside "test 1 file 1 link" folder and not with the "test" and "test without accent" folders. If you run the script on the "test without accent", and then either "test" or "test without accent", the script finishes differently. With the "test 1 file 1 link"  > "fini !". With the other 2 folders, it throws errors > 155 => User canceled this action. What this tells me is that the script encountered different set of conditions, in this case, single vs multiple links. So one of the if, then, else statement is causing this behavior. What you need to do is to stop the script from recursively going to "assemblage" folder and modifying those two files and check your if statements or simplify them. I don't know enough about your usage scenario and extendscript to troubleshoot this script, i am sure others here can help you with that. Please tell us what is your goals. 

 

You must have good reasons to use nested indesign files, but if possible, you should wean off it. 

Accent might not be a problem but i would not use parenthesis in file name. I would delete it in
   Assemblage_fond_couleur_filigrane - Copie (2).indd
for example, in MacOs, the OS will allow characters such as parenthesis, apostrophe in folder name, but script will throw an error when accessing files in folders named with these characters.
Lastly i did this tests in MacOs. So your mileage might varies.

Inspiring
November 9, 2022

about () in the name, it s only into the test file, i have not verify after copy past

 

about the problem i have maybe find, if you have test, that mean you have check the script, and thanks

 

i will draw a picture and tell me if i m right or wrong

 

about nested file, it s my architecture, all my file are nested, for automatisation, and commun file or common style

 

look picture attached

Inspiring
November 7, 2022

when I see these type of symptoms—including your links not updating issue, i would check the server configuration and also the naming of your files and folders. I would move away from accented characters, I would even replace space with underscore. As Loic susggested in the other thread, you should hest it locally, with one spread. This would isolate the local vs. server. If you were on a Mac, I would say try connecting through AFP, if you are using SMB, not sure if AFP is an option in your situation.

Loic.Aigon
Legend
November 7, 2022

call me stubborn but I still consider network latencies the culprit here.

Inspiring
November 7, 2022

i will ask to check this paremeter in first

Community Expert
November 7, 2022

@laurence roussel12011930 said:

"hi if you look the picture attached you can see plant watermark into purple color, but sometime into pdf it s square"

 

Hi @laurence roussel12011930 ,

and this picture is a placed InDesign page?

Or is it something you pasted from the clipboard?

 

As I already said:

[1] Try another method in your script to export the files.

[2] If the sometimes missing pictures are placed InDesign pages, substitute them with placed PDF pages.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Community Expert
November 5, 2022

Hi @laurence roussel12011930 ,

what exactly goes wrong? Could you point me to the issue?

Just a guess: I'd replace the placed InDesign pages with PDF pages.

 

Another thing:

Try a different method to export the PDFs.

asynchronousExportFile()

DOM documentation by Gregor Fellenz:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html#d1e49521__d1e52567

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Inspiring
November 7, 2022

hi if you look the picture attached you can see plant watermark into purple color, but sometime into pdf it s square

Loic.Aigon
Legend
November 7, 2022

Someone suggested that you do a package from your InDesign file and process the file locally. If the export works fine every time, it may be access to a resource issue.

Normally such a square indicates a missing link but if you can get it right by repeating export, then I would consider network access as a possible culprit.