What are the methods for saving ImageDocument (serialization)?
IImage::WriteToFile saves a copy of the current image plane into an image file in the specified format.
Note: this method is a part of the Image object, not of IImageDocument. The file is saved in the external format, saved file can be opened in image viewers and by methods IEngine::PrepareAndOpenImage, IFRDocument::AddImageFile.
IImageDocument::SaveTo saves the contents of the ImageDocument object into a folder on disk. The image is saved in FineReader Engine 12 internal format. It can be opened by calling IEngine::OpenImage. The main feature of this method is very quick opening. Use it in scenarios when it is impossible to keep all images in memory, and it is necessary to very fast open them on demand (for example, in IRecognizedPages interface implementation). Contents of the folder can be viewed by some image viewers, but it is not possible to modify the file in 3-rd party applications - in that case, IEngine::OpenImage method will not load the file anymore.
IImageDocument::SaveToFile saves the contents of the ImageDocument object into a file. It is intended for use in cases when IImageDocument::SaveTo does not suit because of the folder. For example, a saving of the recognized image in a database and generally all process is constructed that is one file instead of the folder. It can be opened by IEngine::LoadImageDocFromFile method. The file may be viewed as an image in some 3-rd party image viewers, but it is not possible to modify it - the IEngine::LoadImageDocFromFile method will not load the file after that.
- IImageDocument::SaveToMemory saves the contents of the ImageDocument object into the global memory, allocated by the GlobalAlloc API function. It is the analog of the previous method, but it operates in memory. To restore the contents of the ImageDocument object from the global memory, use the LoadImageDocFromMemory method of the Engine object.