Error on pdf page is freezing the RunJavaScript("GetPage..")

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

uppugantirama
User
Posts: 6
Joined: Tue Oct 06, 2015 4:17 pm

Error on pdf page is freezing the RunJavaScript("GetPage..")

Post by uppugantirama »

Hi,

I have a pdf document which has some error on the page is shown clearly when I opened through acrobat PDF viewer. (exact message from acrobat : "An error exists on this page. Acrobat may not display the page correctly. Please contact .....")
When same pdf is opened from the PDF-XChange Viewer it is not throwing any error. But, when we execute RugJavaScript() using below command, which is freezing the viewer at exactly the same page where the error occurred through acrobat.

axViewer.RunJavaScript("GetCurrentPage();", out sViewerPage, 0, 0)

from my .Net code, the control is not coming out of that line. It seems there is some kind of stack overflow occurred in that line.

Can you please guide me on how to fix that ?

Thanks
Rama
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error on pdf page is freezing the RunJavaScript("GetPage

Post by Vasyl - PDF-XChange »

Hi, Rama.

Looks like that your issue is document-related because "GetCurrentPage();" isn't a standard feature but must be declared globally or by document-scripts..
Also message "An error exists on this page. Acrobat may not display the page correctly. Please contact ....." - in most case it tells you that document is broken. In some cases our PDF-Viewer may solve silently non-critical issues with document.

Possible workaround: try to call RunJavaScript with PXCVA_Sync flag specified.

If this workaround will not help you - can you provide simple document to reproduce this issue?

Cheers.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
uppugantirama
User
Posts: 6
Joined: Tue Oct 06, 2015 4:17 pm

Re: Error on pdf page is freezing the RunJavaScript("GetPage

Post by uppugantirama »

Thank you so much for your prompt response.

Can you please provide me code snippet on how to setup that flag.

I was checking through the properties of the AxCoPDFXCview object and also the RugJavaScript method. I could not able to find any documentation on how to setup that.

Thanks,
Rama
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19851
Joined: Mon Jan 12, 2009 8:07 am

Re: Error on pdf page is freezing the RunJavaScript("GetPage

Post by Stefan - PDF-XChange »

Hello Rama,

Please take a look here:
Viewer v2.5 ActiveX SDK > Reference > Interfaces > IPDFXCview > General Methods > RunJavaScript
The flags is the last input parameter that you can specify to the RunJavaScript method.

Regards,
Stefan
uppugantirama
User
Posts: 6
Joined: Tue Oct 06, 2015 4:17 pm

Re: Error on pdf page is freezing the RunJavaScript("GetPage

Post by uppugantirama »

Hi,

I tried with that option and still freezing.

I am attaching the sample document. Please let me know, if you need more information.

I am using PDFXCview.exe version 2.5.208. Is it something got fixed in the later versions.

Please let me know.

Thanks
Rama
You do not have the required permissions to view the files attached to this post.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Error on pdf page is freezing the RunJavaScript("GetPage

Post by Vasyl - PDF-XChange »

Hi, Rama.

The version 2.5.208 is too old. We cannot reproduce your issue with the latest build, even with your sample document.
The latest build is 2.5.316, so please update to it and try again...

Also please use try/catch because calling of RunJavaScript may generate COM-exception when any error occurred (invalid/unknown script) (its common/standard way for all COM-objects to throw any error):

Code: Select all

try
{
     axCoPDFXCview1.RunJavaScript(....);
}
catch (Exception ex)
{
}
Also you may try to reproduce issue with our simple example:
"<Program Files>\Tracker Software\PDF-XChange Viewer SDK\Bin\AX_C#Examples\JavaScript.exe"

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.