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

problem with export pdf function

Explorer ,
Nov 05, 2022 Nov 05, 2022

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
  // }
}

 

TOPICS
Scripting

Views

402

Likes

Translate

Translate

Report

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 ,
Nov 05, 2022 Nov 05, 2022

Copy link to clipboard

Copied

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 )

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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
Valorous Hero ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

@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 )

Likes

Translate

Translate

Report

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
Participant ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

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
Valorous Hero ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

i will ask to check this paremeter in first

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

about accented character.... i know but if you know a script for replace all i accept it, because i have maybe 1000link with this charactere type....

Likes

Translate

Translate

Report

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
Valorous Hero ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

ping test is succesfull with 0ms latency

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

i will try to build a small folder for try to deplace in local

 

ps: i have try but very too long, for relink all...

 

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

i use that

 

internal_link[k].relink(internal_link[k].linkResourceURI);

 

 

for relink, but i m not sur if it relink into the main file, i m not familiar with all, i have quickly understand but... i m not scripter, i try , but it s complexe for understand all, my neighbour help me little, but i try to my side to resolve when i can

Likes

Translate

Translate

Report

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
Valorous Hero ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Only a local test proving the same issue would discard network. That it pings quick doesn't mean inDesign will easily retrieve a large asset on the network. I t may be not the issue but what we are offering here is hints to narrow the issue. So discarding the network for good will help.

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

@laurence roussel12011930 as other mentioned try to rule out elements one by one from the equation to figure out who is the culprit. With network access and accented characters coming out as two primary things suggested, you could try by creating a small test case where you only export files that are present locally on your system, if it still fails then you can also try removing the accented characters. Only such mix/match and abstracting the problem to smaller components would help you

-Manan

Likes

Translate

Translate

Report

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 ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

Hi it not exist a script for replace all accented character?

Likes

Translate

Translate

Report

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
Valorous Hero ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

whatever it exists or not, question is: are you sure that the source of your troubles? Otherwise, you may create more troubles than fixing issues.

Likes

Translate

Translate

Report

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

i understand what you mean, but i have no other solution...

 

thuesday we will clean the script, and read it again, for eliminate no used function or line

after we will check each step for be sur all is in order.

 

all work we need just to check save();  close(saveoption.yes) ;everyitem().update ;update() ;relink()

do their correclty their job

 

it miss just a function for check if all link are not in error before close, and a function for check is when we do save() , the document is really saved, because the date change, but the star near the title is again present.

 

will try this

var doc = app.documents[0];

function checkIfOnPage(mItem){
    
    var _OldZeroPoint = app.activeDocument.zeroPoint;     
    app.activeDocument.zeroPoint = [0,0];     
    var _Width =app.activeDocument.documentPreferences.pageWidth;     
    var _Height=app.activeDocument.documentPreferences.pageHeight;     
    var _Bounds = mItem.geometricBounds;
    if ((_Bounds[3] < 0)  || (_Bounds[1] > _Width) || (_Bounds[0] > _Height) || (_Bounds[2] < 0)){
        return false     
    }else{   
        return true 
    }
} 

var mLinks = doc.links; 
for(var i = 0; i < mLinks.length; i++){ 
if ((mLinks[i].status == LinkStatus.LINK_MISSING) && checkIfOnPage(mLinks[i].parent.parent) && mLinks[i].parent.parent.itemLayer.visible == true){ 
alert("Error!\nThis document contains links to files that are missing, use the links panel to fix the problem(s) and try again!");  
exit();
}
else if ((mLinks[i].status == LinkStatus.LINK_OUT_OF_DATE) && checkIfOnPage(mLinks[i].parent.parent) && mLinks[i].parent.parent.itemLayer.visible == true){
mLinks[i].update();
       }
  }

Likes

Translate

Translate

Report

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
Valorous Hero ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

quote

i understand what you mean, but i have no other solution...

 

Allow me to disagree. If your boat is sinking, Rawling twice faster will be no good. Your only solution is to find the holes and see if you can fix them. And your only approach so far is a rush on uncertain "solutions". Let's paint the boat in black, let's wear a different life jacket, and let's move our arms up and down. But none of these actions will help if your holes were nothing related to those actions.

Change accents if you want, but you may discover you will have lost (possibly) time searching a script, possibly writing it, executing it, and noticing it didn't help.

That's a precious time (and I will add the time from the previous week) that you could have spent more wisely by isolating the issue, working on dummy files, and stepping up to the main issue. This humble process is what we have learned painfully ourselves over the years and that we tried to transmit to you in our answers but you don't listen.

Whatever your context, you cannot deny issues and move forward with your fingers crossed because you "have no choices".  

But if that's the road you want to take, I can only wish good luck to you.

Likes

Translate

Translate

Report

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

yep i have a test folder, but he is very basic, of course all work with it

 

it s not i listen, but try tehcnical english is not really easy

 

just keep in your mind i m  not english, and i m not scripter, and my job take all my time and my mind, but i want resolve this script , because it s rewarding when it work

 

it s for that i tell you we will clean our script, i will comment all line, we will read it each step and survey step when save update or relink for verify all is done at the good moment

and verify before save and close the document, than all is without error or not update file

 

i have do a small catalog with only 2 page for quick verify

Likes

Translate

Translate

Report

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

@laurence roussel12011930 if you do listen then act on it as well. Ok lets take a step back. There are other ways to test a scenario in place of searching or a script. If we talk about accented characters if you want to test it why search for a script, prepare a set of files with these characters that is able to cause the issue, then try reproducing the issue so that you have a reliable method to cause it(a random error is difficult to fix, if you know the pattern you have won half the battle). After this replace the accented characters manually on your test data and then see if it resolves the problem if not then we were chasing the wrong path and you can jump over to the next idea.

So what we mean to say is focus on how to test different ideas, find the easiest way to test your hypothesis, don't run after things like a script when you don't even know if the script will solve your problems or not

P.S.:- We all can agree that language is a problem for you, so if you could get in someone who can better express your thoughts in English just ask them to communicate on the forum.

-Manan

Likes

Translate

Translate

Report

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

ok for exemple i know which name file is problem on all my my file and it not contain accent, but... there is "+" in the name ^^

 

i will try without + and check

Likes

Translate

Translate

Report

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

after different test this morning i see all link updated, but i m not sur it s really saved before close or it s save but without changement

Likes

Translate

Translate

Report

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
Valorous Hero ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

You could store the updated status in your script like this :

//a simple logging functionthat will export a linkStatus.txt file to the desktop with useful infos on links
function log(msg){
    var f = new File(Folder.desktop+"/linkStatus.txt");
    f.encoding="UTF-8";
    f.open("a");
    f.writeln(msg);
    f.close();
}

//the function that will parse all links infos and write info to file with log function call
function storeLinksInfo(kDoc){
    var lks, arr = [
    ];
    if(!kDoc || !(kDoc instanceof Document) || !kDoc.isValid) return;
    arr[0] = "- " + kDoc.name;
    lks = kDoc.links.everyItem().getElements();
    while(lk = lks.pop()){
        arr.push("\t- "+lk.name + " >> " + lk.status.toString());
    }

    log(arr.join("\r"));
}

//call this one liner in your script before the close call, so you can have a status of the link at this right moment.
storeLinksInfo(app.activeDocument);

 It will export data like this :

- Sans titre-2
	- Capture d’écran 2022-11-04 à 23.54.51.png >> NORMAL

Likes

Translate

Translate

Report

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 ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

i see a strange thing i don t now if it s normal or not

during the script i call everyitem().update, every where for be use it will do (during my test)

during script work when the file open by recursion, and close all file for return at the main file, symbol to each link not change, (neeg again to bu update)

 

but, if i stop the script manually,all files that have been opened, the link status change

 

my question is why this status change only when script is finish?

my other question is:

and if the update function was not done correctly because the script is running, and as it opens and closes if the update has not been done correctly it does not save it, I will make you a video to show you what I'm explaining

 

i have change some file without space and without +, and try again my script, there is no change,

 

i feel really if script is running, update function not work

i will try with basic script just few line for open/update/save/close

 

if you check the folder i have change the colour into file Assemblage_fond_couleur_filigrane - Copie (2) (replace ref by blue)

 

result into pdf is again red and all file link is not updated

 

Likes

Translate

Translate

Report

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