Page 1 of 1

Viewer getting freezes at the time of annotations injecting

Posted: Wed Jul 12, 2017 6:35 pm
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

Re: Viewer getting freezes at the time of annotations injecting

Posted: Fri Jul 14, 2017 4:17 pm
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

Re: Viewer getting freezes at the time of annotations injecting

Posted: Fri Jul 14, 2017 9:10 pm
by Vasyl-Tracker Dev Team
Hi Ram.

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

Thanks.

Re: Viewer getting freezes at the time of annotations injecting

Posted: Tue Jul 25, 2017 7:05 pm
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

Re: Viewer getting freezes at the time of annotations injecting

Posted: Wed Jul 26, 2017 4:41 pm
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.

Re: Viewer getting freezes at the time of annotations injecting

Posted: Tue Aug 01, 2017 10:39 pm
by Rama
I tried with below code. Still it is happening intermittently.
_axViewer.RunJavaScript(injection, out res, 0, 0);

Thanks
Rama

Re: Viewer getting freezes at the time of annotations injecting

Posted: Wed Aug 02, 2017 9:26 am
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

Re: Viewer getting freezes at the time of annotations injecting

Posted: Wed Aug 02, 2017 6:31 pm
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

Re: Viewer getting freezes at the time of annotations injecting

Posted: Tue Aug 15, 2017 9:14 pm
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

Re: Viewer getting freezes at the time of annotations injecting

Posted: Wed Aug 16, 2017 6:29 pm
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.

Re: Viewer getting freezes at the time of annotations injecting

Posted: Tue Nov 07, 2017 11:16 pm
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

Re: Viewer getting freezes at the time of annotations injecting

Posted: Wed Nov 08, 2017 8:26 pm
by Rama
Can you guys please expedite the help on this?

We are having more users complaining about freezing.

Thanks
Ram

Re: Viewer getting freezes at the time of annotations injecting

Posted: Wed Jan 10, 2018 1:58 am
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