VB data types and JavaScript data types are only truely compatible for the scaler types, Numbers and Strings. Sometimes objects work and sometimes they don't. I don't usually try. The most robust strategy is to pack all your return data into a string, in the JavaScript function, and then parse it out on the VB side.
Thom Parker The source for PDF Scripting Info [url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often [url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat [url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url] [url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
VB side : I use test = jso.addscript("reference('xxxx')") (it's to easy i know, but i want to try and ..... surprise, it doesn't work). I read the IAC doc, but if you have an idea.
Before testing in the VB script, YOU MUST verify that the function works when run from the Acrobat Console Window.
Thom Parker The source for PDF Scripting Info [url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often [url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat [url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url] [url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
- It's possible to write a javascript function in an empty doc PDF ? ( to run it after .... in this document) - It's possible to change the color of an object?
I repeat sorry if my questions have already been asked... Thanks
Yes, of course scripts can be added to an empty PDF. However you don't need to put any code into the PDF. I told you before that you need to put the function in a folder level script and I pointed you to an article on the topic. READ THE ARTICLES!!
Color is a different topic. Post it to a new thread.
Thom Parker The source for PDF Scripting Info [url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often [url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat [url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url] [url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
jso.addScript("ref","app.alert('plus');" ) for try, and when i run the script, jso.ref() the message box display, but my applications crash systematically.
Let me repeat, do not add the script to the PDF. Do not use the "jso.addScript()" function.
What you need to do is to write a FOLDER LEVEL SCRIPT. Put the function in the folder level script and then call the function from the "jso".
Here's an article on Folder Level Scripts: http://www.acrobatusers.com/tutorials/2006/folder_level_scripts
You can also find examples of folder level scripts here: http://www.pdfscripting.com/public/65.cfm
Thom Parker The source for PDF Scripting Info [url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often [url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat [url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url] [url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
The name of the function is "getAnnots3D" with a capital "A". If it's misspelled it won't work. But there also could also be a context problem.
Before testing the specific code you want to run you have to validate your methodology. Write a simple folder level function as a test. Make sure you can run it from the VB program. Then write a folder level function for the real code and make sure it works when executed from the console window.
Thom Parker The source for PDF Scripting Info [url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often [url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat [url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url] [url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script