Leadtools.Document Deprecated as of v16. Refer to: Leadtools.Forms.Ocr | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
UpdatePage Method
See Also  Example
Leadtools.Document Namespace > RasterDocumentEngine Class : UpdatePage Method



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.
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.
Updates the current page with a new image.

Syntax

Visual Basic (Declaration) 
Public Sub UpdatePage( _
   ByVal image As RasterImage, _
   ByVal pageIndex As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterDocumentEngine
Dim image As RasterImage
Dim pageIndex As Integer
 
instance.UpdatePage(image, pageIndex)
C# 
public void UpdatePage( 
   RasterImage image,
   int pageIndex
)
C++/CLI 
public:
void UpdatePage( 
   RasterImage image,
   int pageIndex
) 

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 BasicCopy Code
Public Sub UpdatePageExample()
   ' Load an image
   RasterCodecs.Startup()
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim image As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "ocr1.tif")

   ' Note that this is a sample key, which will not work in your toolkit
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")

   Dim rasterDocument As RasterDocumentEngine
   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 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(LeadtoolsExamples.Common.ImagesPath.Path + "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

Use this method to update a page’s content after applying any image processing method(s). For example, if you do any image processing for your page, then you should update the OCR page by calling this method. You must lock the page to be updated by calling LockPage before calling this method, and should unlock the page by calling LockPage after the update is complete.
For more information, refer to Working with Pages.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

The Leadtools.Document namespace is deprecated and no longer supported as of LEADTOOLS v16. For v16 and later, please refer to: Leadtools.Forms.Ocr. This documentation is retained for v15 and earlier informational use only.