NewAnnotAdded event not executing on doc reload

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

pacela
User
Posts: 4
Joined: Thu Jul 30, 2015 6:11 pm

NewAnnotAdded event not executing on doc reload

Post by pacela »

I'm having an issue I'm hoping you can help me out with. I'm not sure if I may be doing something incorrect or if there's a bug in the product.

I'm setting 'Notifications.NewAnnotAdded.Enabled' when I first open a document. With each annotation added to the doc the event is executed correctly. I then close all the documents and open another document in the same viewer instance. The NewAnnotAdded property is still set to 1 but the event 'Notifications.NewAnnotAdded' isn't fired. The non-fired event continues to occur with each doc loaded in the same viewer instance. If I close the viewer down and load a doc, the events are fired once again until I close all documents and load another document.

Is there another property that needs to be set in order for this to work correctly? Does another property need to be set before or after the 'Notifications.NewAnnotAdded.Enabled'? Am I doing something incorrect in the code below? Is there a bug in the product?

Here's an example of code I'm basically implementing. The GetProperty calls are only there to validate that NewAnnotAdded is actually set to 1.

Code: Select all

    pdfview.GetProperty( 'Notifications.NewAnnotAdded.Enabled', vDataOut, 0); //vDataOut = 0
    pdfview.SetProperty( 'Notifications.Selection.Filter', 'Annotations', 0 );
    pdfview.SetProperty( 'Notifications.NewAnnotAdded.Enabled', 1, 0);
    pdfview.GetProperty( 'Notifications.NewAnnotAdded.Enabled', vDataOut, 0); //vDataOut = 1
    pdfview.OpenDocument(fileName, '', docid, 0);
    pdfview.GetProperty( 'Notifications.NewAnnotAdded.Enabled', vDataOut, 0); //vDataOut = 1
    //Event 'Notifications.NewAnnotAdded' is working

    pdfview.CloseAllDocuments(0);
    pdfview.GetProperty( 'Notifications.NewAnnotAdded.Enabled', vDataOut, 0); //vDataOut = 1
    pdfview.SetProperty( 'Notifications.Selection.Filter', 'Annotations', 0 );
    pdfview.SetProperty( 'Notifications.NewAnnotAdded.Enabled', 1, 0);
    pdfview.OpenDocument(fileName, '', docid, 0);
    pdfview.GetProperty( 'Notifications.NewAnnotAdded.Enabled', vDataOut, 0); //vDataOut = 1
    //Event 'Notifications.NewAnnotAdded' is NOT executed even though property for 'Notifications.NewAnnotAdded.Enabled' = 1
    //Each doc loaded in the same viewer instance will NOT execute the event 'Notifications.NewAnnotAdded'
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: NewAnnotAdded event not executing on doc reload

Post by Tracker Supp-Stefan »

Hello pacela,

I've passed your problem to our devs, and we will try to answer it as soon as possible.

Regards,
Stefan
Wolfgang Weh
User
Posts: 7
Joined: Fri Feb 27, 2015 12:57 pm

Re: NewAnnotAdded event not executing on doc reload

Post by Wolfgang Weh »

Hello pacela,

I remember that I had similar issues.

I'm now always re-setting the properties after using OpenDocument, regardless what the current properties are.

Code: Select all

AxCoPDFXCview1.OpenDocument(pdfFileName)
 AxCoPDFXCview1.GetActiveDocument(_activeDocID)
 _fileName = pdfFileName
 ' Key Down = 1, Up = 2
 TrySetProperty("Notifications.Keyboard.Filter", "Down")
 ' Mouse Down = 2, Up = 4, Down Or Up = 6
 TrySetProperty("Notifications.Mouse.Filter", "Up")
 ' get the results of JavaScript
 TrySetProperty("JavaScript.UseExecResult", "True")
' https://forum.pdf-xchange.com/viewtopic.php?p=78780#p78780
TrySetProperty("Notifications.NewAnnotAdded.Enabled", "True")
TrySetProperty("Commenting.AllowOpenPopupsByDblClick", "False")
TrySetProperty("Commenting.SimpleFocusApp", "True")
That works fine for me.

Regards

Wolfgang
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom

Re: NewAnnotAdded event not executing on doc reload

Post by John - Tracker Supp »

Thanks Wolfgang - appreciate the input, pacela does Wolfgangs solution solve this for you ?

If we hear no more we will assume so ...
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
pacela
User
Posts: 4
Joined: Thu Jul 30, 2015 6:11 pm

Re: NewAnnotAdded event not executing on doc reload

Post by pacela »

Thank you for the suggestion Wolfgang.

I've also tried resetting the properties after the second call of OpenDocument and the NewAnnotAdded event still doesn't trigger. I tried passing in 1 as well as 'True' and the behavior was the same. I'm working with Delphi; maybe there's an issue with these libraries compared to the other language libraries?

Code: Select all

    pdfview.SetProperty( 'Notifications.Selection.Filter', 'Annotations', 0 );
    pdfview.SetProperty( 'Notifications.NewAnnotAdded.Enabled', 1, 0);
    pdfview.OpenDocument(fileName, '', docid, 0);
    //Event 'Notifications.NewAnnotAdded' is working

    pdfview.CloseAllDocuments(0);
    pdfview.SetProperty( 'Notifications.Selection.Filter', 'Annotations', 0 );
    pdfview.SetProperty( 'Notifications.NewAnnotAdded.Enabled', 1, 0);
    pdfview.OpenDocument(fileName, '', docid, 0);
    pdfview.SetProperty( 'Notifications.Selection.Filter', 'Annotations', 0 );
    pdfview.SetProperty( 'Notifications.NewAnnotAdded.Enabled', 1, 0);
    //Event 'Notifications.NewAnnotAdded' NOT working
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: NewAnnotAdded event not executing on doc reload

Post by Vasyl-Tracker Dev Team »

Hi, Pacela.

We cannot reproduce your problem with "Notifications.NewAnnotAdded" (we also tried your code-example). Please check what version of our SDK you using exactly. To be sure 100% - call in you code the:

string clientVer;
string serverVer;
pdfview.GetVersionInfo(out clientVer, out serverVer);

- both, clientVer and serverVer, should be equal to "2.5.0313.0001" - it is last official version.

Best
Regards.
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.
pacela
User
Posts: 4
Joined: Thu Jul 30, 2015 6:11 pm

Re: NewAnnotAdded event not executing on doc reload

Post by pacela »

I upgraded to the same version but the problem still existed.

I went digging again and finally nailed down the one line causing the behavior. The underlying cause is the LoadSettings. If LoadSettings is called more than once for the same Viewer instance, the ‘NewAnnotAdded’ event will not be triggered on the second load of a document whether ‘Notifications.NewAnnotAdded.Enabled’ is set before or after the LoadSettings.
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: NewAnnotAdded event not executing on doc reload

Post by Vasyl-Tracker Dev Team »

Hi, Pacela.

Try next workaround - after LoadSettings call:

Code: Select all

// re-set
pdfview.SetProperty( 'Notifications.NewAnnotAdded.Enabled', 0, 0);
pdfview.SetProperty( 'Notifications.NewAnnotAdded.Enabled', 1, 0);
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.
pacela
User
Posts: 4
Joined: Thu Jul 30, 2015 6:11 pm

Re: NewAnnotAdded event not executing on doc reload

Post by pacela »

Hi Dev team,

The resetting back to 0 and then 1 after the second loadsettings didn't work either. I was able to code around it so I only call loadsettings once per Viewer instance. It'd be good to get that fixed at some point but I'm able to move on now.

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

Re: NewAnnotAdded event not executing on doc reload

Post by Tracker Supp-Stefan »

Hello pacela,

Glad to hear you managed to find a solution.
As we are focusing on the Editor SDK now - I can't promise this will be fixed in the Viewer AX.

Regards,
Stefan