Hey there,
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.
Comments
3 comments
The issue should be solved if you firstly call
and then
Thanks for your answer. We tried your solution, but unfortunately the exception is still thrown. We wonder that this behaviour doesn't occur if we get a reference by the return value of PrepareAndOpenBitmap().
Maybe there is some way to use PrepareAndOpenBitmap() for password protected PDFs to avoid this error?
Unfortunately we did not manage to repeat your issue.
In order we could have a better look at the issue and give you appropriate recommendations, please send us the simple sample project, instructions how to run it, image you process and an AInfo report to SDK_support@abbyy.com.
Please sign in to leave a comment.