Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > General Discussion
  New Posts New Posts RSS Feed - DocJavaScriptAction fails.
  FAQ FAQ  Forum Search   Register Register  Login Login

DocJavaScriptAction fails.

 Post Reply Post Reply
Author
Message
Ruturaaj View Drop Down
Team Player
Team Player
Avatar

Joined: 12 Aug 09
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ruturaaj Quote  Post ReplyReply Direct Link To This Post Topic: DocJavaScriptAction fails.
    Posted: 12 Feb 11 at 7:26AM
Hello All,

I've just upgraded my current installation to version 7.23 and started a new project in which I want to add some JavaScript code to Document Close event. DocJavaScriptAction("WC", sJSCode) used to work before, but it's not working for me anymore. Can someone please confirm that this function is still working for you? 

Just to mention, 

  • I'm having version 10 of Adobe Reader installed on my machine and testing this feature with it. I've not tested the files produced by QP in older versions of Adobe Reader; will report it back here with more details. 
  • It's not the problem with my Adobe Reader as similar JavaScript action code in other file produced with NitroPDF application is working well.
  • The code I'm trying to add to the PDF is bug-free. I add the same code to Document Open event using QP and it works well. 

Waiting for your valuable reply...

Regards,

Ruturaaj.
Back to Top
Ruturaaj View Drop Down
Team Player
Team Player
Avatar

Joined: 12 Aug 09
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ruturaaj Quote  Post ReplyReply Direct Link To This Post Posted: 12 Feb 11 at 8:55AM
Ok. Here I submit some more observations. For testing purpose, I've prepared a PDF file with JavaScript Alert on Document Close.

I double-click the PDF File to open in Adobe Reader and then close Document... JavaScript alert window shown. 

Now, I go to Edit - Preferences menu of Adobe Reader and then go to "JavaScript" section. I tick-mark the "Show console on errors and messages" option here. Now, I open the same test PDF file again and close it... guess what: Now the JavaScript alert starts working. This functionality persists regardless of change in the "Show console..." option of JavaScript section until the Adobe Reader application is closed. Once the application itself is closed the functionality is lost.

Now, again if I double-click the PDF file to open it in Adobe Reader and close it... no JavaScript alert is shown; and surprisingly, the option "Show console..." in JavaScript preferences is still selected! 

I cannot consider this as a bug in Adobe Reader application because PDF files produced with iTextSharp library with same JS Event code is working just fine in the same version of Adobe Reader application and that too regardless of option "Show console". This observation is forcing me to conclude that this is a bug in QuickPDF and this has to be rectified at earliest. Personally, with this error now I find very much dependent on the QP Developers team as my projects are entirely on hold until this error is resolved OR someone suggests me some workaround OR let me know if I'm doing anything wrong. Best is to have someone post a small VB6 program to show me the perfect way to add JavaScript for Document Close event which has worked on other machines and version 10 of Adobe Reader.

Eagerly waiting for your valuable reply...

Regards,

Ruturaaj.

Back to Top
Ruturaaj View Drop Down
Team Player
Team Player
Avatar

Joined: 12 Aug 09
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ruturaaj Quote  Post ReplyReply Direct Link To This Post Posted: 13 Feb 11 at 5:25AM
Ok, here I submit a revised observation: 

I don't see any Message (which is anyway expected to show) when I open my test pdf with document close level javascript embedded in it and close it. Now, I go to Edit - Preferences which presents one Window and I immediately click the "Cancel" button on this window without making any change... then I test my Test.PDF file and guess what... the message starts showing on Document Close! 

I don't know why is this with the PDFs which are generated only by QuickPDF. I don't see this behavior with PDFs created with embedded JS using NitroPDF or any other application. I request you to please have a look at it and let me know the work-around.

Thanks!

Ruturaaj.

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 13 Feb 11 at 6:44PM
Hi Ruturaaj!

To whom you're speaking "...I request you to please have a look at it..."?
This is a user-user-forum ... i think you're long enough here to know.
If you have a bug please post it into the official pages made for this... you know where.
Here - normally - is nobody who can do a bugfix for you ;-)
And - BTW - it's weekend ... so you should be more patient.

Cheers, Ingo

Back to Top
Ruturaaj View Drop Down
Team Player
Team Player
Avatar

Joined: 12 Aug 09
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ruturaaj Quote  Post ReplyReply Direct Link To This Post Posted: 13 Feb 11 at 9:07PM
Hi Ingo,

First, I want to submit my query to those who are using this Lib, just to make sure that there is no error in my coding or if there is any specific method to achieve which I'm willing to. That's the reason why I posted this "query" here, in anticipation that someone will follow the steps to recreate the issue and will report back if they are facing the same issue or it's just me. 

Yeah my friend, I'm indeed patiently waiting for some valuable reply... the reason why I went on updating this thread is just to keep you all informed about the different findings that discovered while trying to trace the issue. Again, all this posted here just to make sure if someone else also can recreate this issue, nothing else really.

Have a nice week-end... and just have a go at this issue when you're back. This will help all of us to conclude if this is a Bug in Lib or otherwise.

Cheers,

Ruturaaj.

Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 17 Feb 11 at 9:00AM
I don't think this is a bug in Quick PDF Library because I was able to replicate the same issue without ever using Quick PDF on the PDF. I've been able to replicate the same issue in Acrobat using a PDF that I created in Acrobat and a PDF that I created in Nitro PDF. Strangely enough, Acrobat and Adobe Reader seem to sometimes have trouble firing the WC event when a document is closed. 

Acrobat works sometimes and other times it does not. The fact that it works after you go to *Edit > Preferences* and then *Cancel*, is an indication that something is amiss in Acrobat.

The one PDF that you sent through which did always work with the WC event in Acrobat also included an OpenAction entry (which did not include any JavaScript). It seems as if the presence of this OpenAction entry brings the JavaScript handler to life and makes it ready for when the WC event is triggered.

Note that all of the PDF files that I tested worked correctly in Nitro PDF. It was only Acrobat which was having the issue.

So the trick to get Acrobat to work correctly with the WC event is to add an OpenAction to the document. It does not need to have any JavaScript associated with it. It just needs to be present.

For example in C# you would do this:

    QP.DocJavaScriptAction("WC", "app.alert(\"This is a test message on Document Close\");");
    QP.SetOpenActionJavaScript("// optional JS here");
    QP.DrawText(10, 700, "DocJavaScriptAction Test");
    QP.SaveToFile("test.pdf");

It's a very strange issue but I'm confident that Quick PDF Library is not the cause beause I could replicate the problem when I was using only Acrobat itself to create the PDF and add the Set Document Action JavaScript event.
Back to Top
Ruturaaj View Drop Down
Team Player
Team Player
Avatar

Joined: 12 Aug 09
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ruturaaj Quote  Post ReplyReply Direct Link To This Post Posted: 18 Feb 11 at 1:51PM
You're absolutely correct Rowan.Problem is not with QP. It's a tricky issue and your trick to overcome this tricky thing is working well! Smile

It looks like the JS parser and execution handler thread remains dormant unless triggered. Adobe has no problems to make it work on Document Open (thankfully it's getting triggered without any native action such as Preferences dialog thing). I don't know if it's for Resources or Security policy (more likely the Resources), but it makes the JS support in Adobe very interesting! This issue also highlighted that Nitro developers have developed their own PDF rendering mechanism, which is entirely based on their own philosophy of PDF File handling.

Nonetheless, we've people like Rowan who can come up with wonderful observations and the solution to get rid of such strange behaviors of Adobe Reader. Thanks so much for your valuable & insightful assistance.

Regards,

Ruturaaj.


Edited by Ruturaaj - 18 Feb 11 at 1:59PM
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store