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

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.




  • Avatar
    Julia Anikushina

    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 with which we could reproduce the issue.

  • Avatar
    Philipp Eger

    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.


Please sign in to leave a comment.