These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Execute script on print_button::click/preprint not possible

djinges
Registered: Jun 27 2007
Posts: 55
Answered

Hi folks,

could you tell me, why it is not possible to call a funktion in click or preprint event of print button?

I've a function called NullFieldValue(obj). This function traverse each item of the given object (collection) 'obj' and reset the rawValue of each object item to null. It works recursively.

This function works elsewhere fine, but in click or preprint of a print button?

Thanks for your help in adv!

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Interesting! Does it throw an execption? What is the failure mode? Have you placed "console.println()" statments in the code to trace whats going on?

The PrePrint event has some timing restrictions so there are definately some things that won't work. Although I wouldn't think modifying the rawData would be a problems. And this should not be a problem at all for the click event. It seems like there is something else going on, rawData modification by itself shouldn't cause a failure.

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

djinges
Registered: Jun 27 2007
Posts: 55
HI Thomp,

sorry for late answer! I have not try to use console.printl() yet.

Like you note, there is some timing restrictions in preprint(), but how about click()? Calling the funtion NullFieldValue() before obj.print() isnt work! Nothing happens then???

It's just weird because of it works elsewhere fine!? I will try my best and will tell you when i find solution therefore!

Thanks for your help anyway and best regards!

Djinges
djinges
Registered: Jun 27 2007
Posts: 55
Hi Thomp,

sorry for the bug! The error is sitting in front of the screen!) I've typed the function's name wrong in print_button::click().

Thanks a lot for your noble support! Have a nice time and see you!

Djinges
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Sometimes the most obvious things are the hardest to see and it just takes bouncing an idea off of someone else. I often find that I don't even need an answer. Just forming the question forces you to look harder and see things you missed before.

Cheers,

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script