-
1. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
try67 Mar 17, 2017 3:18 AM (in response to andrejtmtld)What is the full text of the error message? Also, are you getting it when you run this code, or when you click one of the links you're creating?
-
2. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 20, 2017 5:25 AM (in response to try67)I only get the error message when I create the links. There is no more text than "GeneralError: Operation failed. Root.(null):Number:Batch undefined: Exce script terminated.
BTW: The code creates both links (and both work!), but subsequent commands are interrupted and the error message points to the setAction command.
-
3. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 20, 2017 7:40 AM (in response to andrejtmtld)You use the whole code in a folder-level JavaScript file?
-
4. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 20, 2017 8:21 AM (in response to Bernd Alheit)Yes, exactly. Actually I created a Sequence File (SEQU) with this content and further commands to add checkboxes to a stactic PDF file to make it a PDF form with attachments.
-
5. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 20, 2017 8:28 AM (in response to andrejtmtld)A folder-level JavaScript file and a sequence file is not the same.
Code in folder-level JavaScript files will be executed at startup of Adobe Acrobat.
-
6. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 21, 2017 11:27 PM (in response to Bernd Alheit)So it is not a folder-level JavaScript but a script which is run as action (sequence).
Anyhow: How can I prevent the error when running the batch sequence? What could be the reason for this error? -
7. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 22, 2017 4:37 AM (in response to andrejtmtld)Did you get the error with any PDF file?
-
8. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 22, 2017 6:13 AM (in response to Bernd Alheit)This is the issue: The error occurs in about 80% of the cases, so not always.
BTW: Is it important to have a delay between import of the PDF file and the linking to the text?
If yes: How to implement the delay? -
9. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 22, 2017 7:14 AM (in response to andrejtmtld)What happens when you remove the import of the PDF files?
-
10. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 22, 2017 8:05 AM (in response to Bernd Alheit)The rest of the program runs always smoothly if I remove the PDF import and the linking to the PDF file.
-
11. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 22, 2017 8:36 AM (in response to andrejtmtld)Remove only the PDF import.
-
12. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 22, 2017 9:16 AM (in response to Bernd Alheit)Same issue:
GeneralError: Operation failed.
Root.(null):3984:Batch undefined:Exec
script terminatedSo the issue is not related to the PDF import.
Clicking the created link triggers (correctly) the error:
TypeError: Invalid argument type.
Doc.exportDataObject:1:Link:Page1:Annot14:Action1
===> Parameter cName. -
13. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 22, 2017 12:10 PM (in response to andrejtmtld)On how many files do you use the action?
-
14. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 22, 2017 10:49 PM (in response to Bernd Alheit)I use the action only on the specific open PDF file.
The complete batch file (which creates checkboxes and adds attachments) is quite large, i.e., processing of the whole file takes about 2 Minutes (file size of the batch as SEQU file is about 150kB).
Is there any type of limitation due to memory resources?
-
15. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 23, 2017 3:14 AM (in response to andrejtmtld)Looks like a problem with setAction.
-
16. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 24, 2017 2:06 AM (in response to Bernd Alheit)I checked the whole loop in the JS debugger... The issue is not related to setAction, but to the for-loop. I assume that searching for a text (which will be linked) can be implemented in a more clever way.
Thanks anyhow!
-
17. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
Bernd Alheit Mar 24, 2017 2:50 AM (in response to andrejtmtld)The reason for this may be that the method addLink changes the document.
-
18. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
try67 Mar 24, 2017 3:27 AM (in response to andrejtmtld)I think you're right. Your loop is very strange. I don't understand the whole do-while section of it and the use of the "spc" variable. I think you don't need it at all, if I understand correctly what you're trying to do.
And no, adding a link does not change the file in a way that should interfere with this loop, since you're not adding actual text.
-
19. Re: Error when linking text to an PDF attachment - GeneralError: Operation failed. Root.(null):xxxx:Batch undefined:Exec script terminated
andrejtmtld Mar 24, 2017 5:10 AM (in response to try67)The reason for the do-while section is the command getPageNthWord. The command limits words by not only by a whitespace, but also e.g. by an underscore. Since I have to reference the whole filename, I have to find the complete string up to a real space char.
As the program "searches" the file extension, I have to step backwards through the text.
But again: This results from a routine which is not an optimal solution for my purpose. I rather have to search for the filename in the text, find the position in terms of "getPageNthWord". I might therefore analyze the search string to retrieve the number of "sub-words" (see remark above) and directly apply the routing to get the boundary box on the first and last sub-word.
The processing of the two cascaded for-loops (jj, i) takes most of the time (the two minutes are required for a 50 page document with 90% of text per page).