Updates the current page with a new image.
Syntax
Parameters
- image
- An RasterImage object that references the new page to be updated in the internal OCR list of pages.
- pageIndex
- Index of the page to be updated. This is a zero-based index.
Example
Visual Basic | Copy Code |
---|
Public Sub UpdatePageExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim image As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\ocr1.tif")
RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")
Dim rasterDocument As RasterDocumentEngine
rasterDocument = RasterDocumentEngine.Instance
rasterDocument.Startup()
Try
rasterDocument.LockPage(0, True)
rasterDocument.UpdatePage(image, 0)
rasterDocument.LockPage(0, False)
MessageBox.Show("The engine successfully updated the Page")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
rasterDocument.Shutdown()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void UpdatePageExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\ocr1.tif"); // Note that this is a sample key, which will not work in your toolkit RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey"); RasterDocumentEngine rasterDocument; rasterDocument = RasterDocumentEngine.Instance; rasterDocument.Startup(); // assume page is added, refer to AddPage example for more information try { rasterDocument.LockPage(0, true); rasterDocument.UpdatePage(image, 0); rasterDocument.LockPage(0, false); MessageBox.Show("The engine successfully updated the Page"); } catch (Exception ex) { MessageBox.Show(ex.Message); } rasterDocument.Shutdown(); RasterCodecs.Shutdown(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also