Viewer getting freezes at the time of annotations injecting

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

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
Rama
User
Posts: 9
Joined: Wed Jul 12, 2017 6:23 pm

Viewer getting freezes at the time of annotations injecting

Post by Rama »

Hi,

I am using below event to inject annotations. It is always freezing.

private void axViewer_OnEvent(object sender, AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent e)
{
if (e.name.EndsWith("ContentReady") )
{
AnnotationsInject(); // this method we use to inject the annotions.
}
}

Looks like ContentReady is not happening properly. Event is rising before content is ready. Which is causing annotations get injected before the content ready hence freezing is happening.
Can you please help me on how to avoid this?

Thanks
Ram
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Viewer getting freezes at the time of annotations injecting

Post by Tracker Supp-Stefan »

Hello Ram,

I've passed this to the lead dev that worked on the Viewer SDKs, and will post back again here as soon as I get any feedback from him.

In the mean time - can you please confirm which build of the Viewer SDK are you using? (You can check the version of the dll files)

Regards,
Stefan
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Viewer getting freezes at the time of annotations injecting

Post by Vasyl-Tracker Dev Team »

Hi Ram.

Please details: how do you add comments into document? may be piece of AnnotationsInject() code?

Thanks.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Rama
User
Posts: 9
Joined: Wed Jul 12, 2017 6:23 pm

Re: Viewer getting freezes at the time of annotations injecting

Post by Rama »

Here it is :

private void AnnotationsInject()
{
AnnotationsInjectInterface();
AnnotationAddToViewer(note);
}


private void AnnotationsInjectInterface()
{
try
{
string injection = ResourceManager.GetString(".ViewerInterface.js");

_axViewer.RunJavaScript(injection);
}
catch (Exception ex)
{
ShowErrorMessage(ex); ;
}
}

private void AnnotationAddToViewer(DocumentNote NewAnnot)
{
string JSCommand = "AddAnnotation(\"" + System.Uri.EscapeUriString(SerializedAnnotation) + "\");";
_axViewer.RunJavaScript(JSCommand);
}

Please let me know if this is not sufficient.
Thanks
Rama
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Viewer getting freezes at the time of annotations injecting

Post by Vasyl-Tracker Dev Team »

Hi Ram.

Try to call the RunJavaScript in synchronous mode:

Code: Select all

_axViewer.RunJavaScript(jscript, out res,  0, PXCVA_Sync);
HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Rama
User
Posts: 9
Joined: Wed Jul 12, 2017 6:23 pm

Re: Viewer getting freezes at the time of annotations injecting

Post by Rama »

I tried with below code. Still it is happening intermittently.
_axViewer.RunJavaScript(injection, out res, 0, 0);

Thanks
Rama
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17823
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Viewer getting freezes at the time of annotations injecting

Post by Tracker Supp-Stefan »

Hi Rama,

Vasyl asked you to try with Synchronous mode - and the code you said you tried is not using the same parameter. Please try with what Vasyl suggested, and let us know if it helps!

Regards,
Stefan
Rama
User
Posts: 9
Joined: Wed Jul 12, 2017 6:23 pm

Re: Viewer getting freezes at the time of annotations injecting

Post by Rama »

My bad, I should have mentioned this in my previous post.

I tried this _axViewer.RunJavaScript(jscript, out res, 0, PXCVA_Sync);

but PXCVA_Sync is not recognizing in the code. Looks like it requires some DLL needs to be added. That is the reason why i replaced that with integer 0 as method expecting integer.

public virtual void RunJavaScript(string script, out string result, int iD, int flags);

Please let me know, if i am missing anything.

Thanks
Rama
Rama
User
Posts: 9
Joined: Wed Jul 12, 2017 6:23 pm

Re: Viewer getting freezes at the time of annotations injecting

Post by Rama »

Do you guys have any update on this?

Do you have any sample projects in .Net which have some code snippets of how to show the pdf documents and record the annotations to database table. l

Thanks,
Rama
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Viewer getting freezes at the time of annotations injecting

Post by Vasyl-Tracker Dev Team »

Please look to our existing SDK-examples (../C#Examples/FindText project, for example). There PXCVA_Sync flag is used for some performance purposes..

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Rama
User
Posts: 9
Joined: Wed Jul 12, 2017 6:23 pm

Re: Viewer getting freezes at the time of annotations injecting

Post by Rama »

I tried the code example you mentioned and still users getting freezing once in a while.

It happens at some percentage value as shown in the attached document.

It is happening as i mentioned earlier at the time of document opening and injecting the annotations.

Please provide me the code snippet of injecting saved annotations once the document got loaded.

The more users working on the Document viewer the more they see this freezing.

Thanks in advance for all your help on this.

Ram
Attachments
Capture.PNG
Rama
User
Posts: 9
Joined: Wed Jul 12, 2017 6:23 pm

Re: Viewer getting freezes at the time of annotations injecting

Post by Rama »

Can you guys please expedite the help on this?

We are having more users complaining about freezing.

Thanks
Ram
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Viewer getting freezes at the time of annotations injecting

Post by Vasyl-Tracker Dev Team »

Hi Rama.

Can you try to slightly change your code? Instead of changing the document inside from OnEvent(ContentReady) just try another 'lazy update' method like:

Code: Select all

private void axViewer_OnEvent(object sender, AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent e)
{
  if (e.name.EndsWith("ContentReady") )
  {
      // post ('lazy') event to itself to inject annotations (maybe by using window's PostMessage)
  }
}
....
OnInjectAnnotsEvent(...)
{
    AnnotationsInject();
}
HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer

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