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

Problem with 'this.closeDoc' script in a browser

historyboy
Registered: Sep 29 2008
Posts: 9
Answered

Help for a new boy please! I have looked throughout the forum without finding what I need, so here is my first post.

We have a need to print a banner on some documents to include some user-entered text (container number), so that the printed form is specific for a certain piece of kit. The script works fine, but the entered text needed to be mandatory - just ignoring it wasn't allowed. An extra bit of script was added using the 'this.closeDoc' function to close the document if nothing was entered. This also works fine if opened directly into Adobe Reader, but if opened via the intranet into a browser, it allows people to close the dialog box and carry on!

I found reference on another post saying "the closeDoc() function will not work in the Acrobat/Reader web plugin" (see here http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=12582) but no suggestion as to what to use instead!

Is there a way to get this function to work via a web browser (IE)? Or am I completely sunk?
The script we are using can be provided if required.

maxwyss
Registered: Jul 25 2006
Posts: 255
There is actually not much you can use instead, because it is the browser providing the window environment, and not Acrobat (Reader).

What you can do is opening another PDF document. That would close the previous one (if you are in the browser).

In some Acrobat (Reader) versions, it was (is) possible to get an URL using the javascript: protocol, which executes a browser-javascript. However, as said, it may or may not work, depending on the Reader version, and the newer the Acrobat/Reader is, the less likely it is.

Hope this can help.

Max.
historyboy
Registered: Sep 29 2008
Posts: 9
Max, thanks for the quick reply - I had not realised it would be so tricky!

We mainly use IE6 and Adobe Reader 7, but there are a few newer versions about as well.

If I can't use this function, I guess I could just remove the option for them to close the box, and turn it into a nag screen. Would that work do you think? (apart from being very annoying I mean).
maxwyss
Registered: Jul 25 2006
Posts: 255
Linking to another document would definitely work.

Max.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Consider using the doc.getURL method.

George
historyboy
Registered: Sep 29 2008
Posts: 9
Thanks for your help guys, I'll try the method of opening a new document, where I'll put a relevant message to the users.

Best regards
origfirefox
Registered: Oct 13 2008
Posts: 4
I have also had issues with the CloseDoc() method in adobe 8 and 9. See the forum info below (link). Any feedback would be great and would help others having the same issue.

Problem interating through dataobjects in Adobe 8 and 9 (1 of 1):

http://www.adobeforums.com/webx/?13 [at] 957 [dot] AIJHiw[email protected]/12-Bill
historyboy
Registered: Sep 29 2008
Posts: 9
Bill

I did not progress anything more with the 'this.closeDoc' script, nor with opening another document instead. All I did was change my script to force users to enter a value in the field, whether they wanted to or not. After that, they could close the document if required. Not so friendly, but it works.

It is a shame that changes to the platform do seem to disable useful functionality such as this, or interactions between applications such as Adobe Reader and IE.

Sorry I can't be of any help - well beyond my ability.

Regards

Andy
origfirefox
Registered: Oct 13 2008
Posts: 4
Andy,

You are way smarter then you think.

I was able to solve my issue by just removing the CloseDoc() method. You are right it is a shame. My code worked fine in Pro 9 but not in Reader 9...go figure! How can one develop and troubleshoot code for Reader 9 adequately.

-Bill