problem with export pdf function
Copy link to clipboard
Copied
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
// }
}
Copy link to clipboard
Copied
When code is executing we can have situations where the UI is not updated promplty in sync with the code. So in your case it is very much possible that the update call was fired and it did work but the UI is not updated to show a change in the status icon. As soon as you stop the script InDesign gets some idle time and hece refreshes the link. So relying on the UI refresh is not a reliable test to know if the code worked or not. You need to test the results and then conclude if the code is working or not.
-Manan
Copy link to clipboard
Copied
understand i continue to do my test folder
Copy link to clipboard
Copied
wouhouuu i m happy, i do a local file...... and it not work....
that eliminate accent and network.. now i can share with you this folder ^^
https://www.dropbox.com/sh/afw1vrmu989kdc7/AABtLOI-bZtGOcXbv9lW6M5ea?dl=0
my script is not yet cleaned, this morning i add lot of time update function, for check if it help or not,
Copy link to clipboard
Copied
wouhouuu i m happy, i do a local file...... and it not work....
By laurence roussel12011930
That's an important piece of info and you see why now I told you not to rush. Now you know editing accents wouldn't have been of any help.
Now next step is to know if indd linked files are the issue. So you need to use, if not already, standard link files such as jpg, pdf, what you want. And process your script. Because we don't know at this stage if the process of updating indd links may be the source of your issue.
Copy link to clipboard
Copied
i will disconnect this one in first
Assemblage_fond_couleur_filigrane - Copie (2)
i feel the problem from it
Copy link to clipboard
Copied
i have understand than all file linked with .doc are updated (method relink())
but all file indd link with other .indd are not updated method update()
remove Assemblage_fond_couleur_filigrane - Copie (2) = no change
if someone want test to his side, the folder have only few link to relink to your site
updated into shared folder a folder without accent, same problem
updated, 1 file =1link same probleme only from Assemblage_fond_couleur_filigrane - Copie (2) (will chek level)
last test: if i have over 4level link, the fourth level and over are updated and saved, but 1/2/3 is not
if under 4 level it work
it s strange, i don t understand the relation with level recursion and update() function.
other test
0 1 2 3 4
main file-> 1 indd link -> 1 indd link+ 1 psd link->1 indd link = not work 0/1 is not updated
main file-> 1 indd link -> 1 indd link->1 indd link + 1indd link + 1 psd link= not work 0 is not updated but under it s updated and saved
main file-> 1 indd link -> 1 indd link->1 indd link + 1 psd link -> 1indd link + 1 link .doc modified= nothing is updated
main file-> 1 indd link -> 1 indd link->1 indd link ->1indd link ->1 indd link -> 1 link .doc modified= nothing is updated
main file-> 1 indd link -> 1 indd link->1 indd link -> 1 .doc link = all is updated and saved
sorry will all test i m lost...
Copy link to clipboard
Copied
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-upda...
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
it s activate for me
but during script i ask no interaction level
Copy link to clipboard
Copied
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...


-
- 1
- 2