Loading...

OCR a specific Zone of a PDF page

Example requests & Code samples for GdPicture.NET Toolkits.

OCR a specific Zone of a PDF page

Postby Loïc » Tue Jul 26, 2011 4:56 pm

Code: Select all
   Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
      Dim oGdPictureImaging As New GdPictureImaging
      Dim oGdPicturePDF As New GdPicturePDF
      Dim RasterPageID As Integer

      If oGdPicturePDF.LoadFromFile("c:\test.pdf", False) = GdPictureStatus.OK Then
         oGdPicturePDF.SelectPage(1) 'Selecting first page
         RasterPageID = oGdPicturePDF.RenderPageToGdPictureImage(200, True) '200 DPI rendering
         oGdPicturePDF.CloseDocument()
         oGdPictureImaging.SetROI(0, 0, 1000, 1000) ' here we make a region of interest from (0, 0) to (1000, 1000)
         oGdPictureImaging.OCRTesseractSetOCRContext(OCRContext.OCRContextDocument) 'You can use another context if possible. This can increase accuracy
         MsgBox(oGdPictureImaging.OCRTesseractDoOCR(RasterPageID, "eng", "C:\Program Files\GdPicture.NET 8\Redist\OCR", ""))
      End If


      'Clearing ressources
      oGdPictureImaging.ReleaseGdPictureImage(RasterPageID)
      oGdPictureImaging.Dispose()
   End Sub



Feel free to post any comment, suggestion or support request in this thread.
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Return to Example requests & Code samples For GdPicture.NET

Who is online

Users browsing this forum: No registered users and 0 guests