PageAdded event is fired only sporadic by using FRDocument.AddImageFileWithPasswordCallback() method

  • 5.4K Views
  • Last Post 15 November 2013
  • Topic Is Solved
Philipp Eger posted this 14 November 2013

Hey there,

we are using Abbyy Finereader SDK 10 and noticed, that PageAdded event is not fired in some cases, when we're importing pages. Our codes lookes like

FRDocument document = _Engine.CreateFRDocument();
document.Pages.PageAdded += Document_PageAdded;
//Initialize password callback and creating PrepareImageMode object
document.AddImageFileWithPasswordCallback(path, passwordCallback, prepareImageMode);

The registered EventHandler for Page_Added is not entered in some cases and we couldn't see a regularity in this.

Thanks for your help.

  • Liked by
  • Julia Anikushina
Order By: Standard | Newest | Votes
Julia Anikushina posted this 15 November 2013

This behavior can occur when one subscribes for events of the FRPages object, but does not keep a reference to this object. At some point the Garbage Collector frees the FRPages object (as there are no references to it) and information about its subscribers is lost.

As a solution we can recommend you to keep the reference to the FRPages object in some class member without letting it die.

Hope this information will be useful for you. In case these recommendations do not solve the issue, please send us the simple sample project to SDK_support@abbyy.com with which we could reproduce the issue.

  • Liked by
  • Philipp Eger
Philipp Eger posted this 15 November 2013

Thanks for your help. Your hint helped us a lot, now we save an explicit reference of the pages collection and it seems to work after our first test.

Close