Iterating Document Pages

When you work with analysis, recognition, or synthesis results, you may need to iterate document pages and blocks on them. In this case, you should take into account that when you request a document element (e.g., a page or a block) for viewing or editing, the data is loaded into memory and stays there until it is unloaded explicitly. This may lead to an "out of memory" error. To prevent it, follow the recommendations below.

Iterating document pages

When you use processing methods of the FRDocument object, layouts and image documents will be unloaded to disk automatically.

But if you request a page of a document and its blocks for viewing or editing, the data is not unloaded or saved automatically. If you are viewing or editing a number of pages, you should unload the data after you have finished working with each page. It means that you should call the Flush method of the FRPage object.

On the other hand, if you make some changes while iterating through pages, you need to call the Flush method to save these changes. Otherwise, if you call, for example, the SaveToFolder or one of the export methods of the corresponding FRDocument, your changes will be saved to the folder (or the exported document) but will be cleared from the object you are working with.

See also

FRDocument

Working with Text

03.07.2024 8:50:25

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.