Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: PDF::Reuse - adding javascript

by qq (Hermit)
on Dec 13, 2004 at 17:11 UTC ( [id://414467]=note: print w/replies, xml ) Need Help??


in reply to Re^3: PDF::Reuse - adding javascript
in thread PDF::Reuse - adding javascript

I may not be understanding you here. I have Reader, and when I open the resulting pdf (created by PDF::Reuse), I get a blank document. That's how I know that something's wrong - I'm not seeing a form field. Of course I've checked that javascript is enabled, etc.

I agree that the fact that the javascript appears within the pdf file (the strings test) doesn't mean its in the right place, or that its being initialized/called correctly.

Other uses of PDF::Reuse seem to work fine.

Standalone javascript interpreters verify the syntax is ok, although I can't test much else (because the "this" object refers to the Adobe doc object.

A much stripped down javascript examples also failed (I posted a long one since it was from the Tutorial docs, and I didn't want to risk my javascript syntax being the problem).

If I had Acrobat I'd have another way to approach the problem, and I could follow the Adobe docs, etc.

Thanks again, qq

Replies are listed 'Best First'.
Re^5: PDF::Reuse - adding javascript
by stvn (Monsignor) on Dec 14, 2004 at 01:38 UTC
    Standalone javascript interpreters verify the syntax is ok, although I can't test much else (because the "this" object refers to the Adobe doc object.

    There is always a way to test! You can create a mock object of the Adobe DOM. It looks like you have only a few calls to it, and it returns some sort of form element object (which you can also mock up). And not only will this allow you to test this outside of Acrobat, but it will also help by getting you more familiarized with the Adobe DOM itself. Here is a basic mock up, which (if my Javascript knowledge is not too rusty) should work and deal with the "this" in your code properly as well.

    function MockAdobeDOM () { // ... any bookkeeping code you want here } MockAdobeDOM.prototype.addField = addField; MockAdobeDOM.prototype.nameAddress = nameAddress; function addField (fieldName, fieldType, thePage, myRec) { // return mock field object you are asking for } function nameAddress(page, xpos, ypos) { // ... your code here ... }

    -stvn
Re^5: PDF::Reuse - adding javascript
by dragonchild (Archbishop) on Dec 13, 2004 at 17:50 UTC
    Have you tried parsing the PDF with one of the free PDF parsers you can find through Google? Maybe PDF::Reuse can help you here ...

    Plus, how much do you actually know about the Adobe DOM? It sounds like you're doing more than you understand (though examples should always work). Have you asked the author of PDF::Reuse for help?

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      I'm working my way through the Adobe JavaScript docs, so although I'm currently working at the limit of my understanding, hopefully that situation will change. It doesn't seem unreasonably complicated.

      I have mailed the author, but no response yet.

      Thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://414467]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found