we get an AccessViolationException when trying to access the ImageDocument of an FRPage after moving pages between documents and removing some of the documents. We only get this Exception after using one of AddImageFile-methods to fill pages to our documents. We do not get this exception if we use the PrepareAndOpenBitmap() / PrepareAndOpenImage() method.
We even know this KB article: Abbyy KB article 1565 All calls to the FREngine are made from same thread (same id) and thread state is always STA.
Our code looks like this:
List<FRDocument> allDocuments = new List<FRDocument>(); //Create passwordCallback, _Engine and prepareMethod FRDocument doc1 = _Engine.CreateFRDocument(); doc1.AddImageFileWithPasswordCallback("filePath", passwordCallback, prepareMode, null); FRDocument doc2 = _Engine.CreateFRDocument(); allDocments.Add(doc1); allDocments.Add(doc2); int i = 0; FRPage page = doc1.Pages.Item(i); doc1.Pages.Remove(i); doc2.AddImage(page.ImageDocument); allDocments.Remove(doc1); ImageDocument imDoc = doc2.Pages.Item(0).ImageDocument; //Here the exception is thrown
We would avoid this error by using the PrepareAndOpenBitmap() method in our code but this doesn't seem to support password protected pdf documents.
Do you have some hints? Thanks for your help.