- image
- A RasterImage object that contains the image data that will be copied into this IOcrPage.
Visual Basic (Declaration) | |
---|---|
Overridable Sub SetRasterImage( _ ByVal image As RasterImage _ ) |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
virtual void SetRasterImage( RasterImage image ) |
C++/CLI | |
---|---|
virtual void SetRasterImage( RasterImage image ) |
Parameters
- image
- A RasterImage object that contains the image data that will be copied into this IOcrPage.
Once you add a page to an OCR document, the image data used to create the page is copied and stored inside the engine even if the original object used to create the page was a RasterImage object. To get a RasterImage that represents this page, use GetRasterImage.
The RasterImage object that the GetRasterImage method returns contains a copy of the page image data. Any modifications you make to the RasterImage object will not affect the page. To update the page image data, you must call SetRasterImage. Since the RasterImage object is a copy, you must dispose it by calling its RasterImage.Dispose method once you are done using it.
Once you obtain a RasterImage object for this page, you can use it with other parts of LEADTOOLS, for example, you can set it in the RasterImageViewer or RasterPictureBox controls for viewing inside your Windows Forms-based application. You can also perform your own image processing on the page as follows:
// Flip the 2nd page added to the OCR document
// Get the page (index is zero-based)
IOcrPage page = ocrDocument.Pages[1];
// Get a RasterImage object that represents this page
Leadtools.RasterImage image = page.GetRasterImage();
// Flip it vertically
Leadtools.ImageProcessing.FlipCommand flip = new Leadtools.ImageProcessing.FlipCommand();
flip.Horizontal = false;
flip.Run(image);
// Set it back into the page
page.SetRasterImage(image);
// Dispose the image
image.Dispose();
You can also get a RasterImage object representation of a page with the IOcrPageCollection.ExportPage method.
The RasterImage object returned from the GetRasterImage method will contain one page only. To get a multi-page RasterImage object containing the image data of all or a specific range of the pages added to the OCR document, you can either create a RasterImage from the first then loop through the pages of the document and add the returned RasterImage objects to the first object with the RasterImage.AddPage method. Or you can use the IOcrPageCollection.ExportPages methods.
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family