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!
DocJavaScriptAction fails. |
Post Reply |
Author | |
Ruturaaj
Team Player Joined: 12 Aug 09 Status: Offline Points: 29 |
Post Options
Thanks(0)
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,
Waiting for your valuable reply... Regards, Ruturaaj.
|
|
Ruturaaj
Team Player Joined: 12 Aug 09 Status: Offline Points: 29 |
Post Options
Thanks(0)
|
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. |
|
Ruturaaj
Team Player Joined: 12 Aug 09 Status: Offline Points: 29 |
Post Options
Thanks(0)
|
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. |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
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 |
|
Ruturaaj
Team Player Joined: 12 Aug 09 Status: Offline Points: 29 |
Post Options
Thanks(0)
|
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. |
|
Rowan
Moderator Group Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
|
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.
|
|
Ruturaaj
Team Player Joined: 12 Aug 09 Status: Offline Points: 29 |
Post Options
Thanks(0)
|
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!
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store