EMF to Searchable PDF

Example requests & Code samples for GdPicture Toolkits.
Post Reply
User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

EMF to Searchable PDF

Post by Loïc » Tue May 04, 2010 4:29 pm

Code: Select all

Dim oGdPictureImaging As New GdPicture.GdPictureImaging
oGdPictureImaging.SetLicenseNumber("XXX") 'Replace xxx by valid key
'Step1: Apply white background to src image. This can be done drawing the metafile on an empty white canvas
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromMetaFile("d:\test.emf")
Dim ImageWidth As Integer = oGdPictureImaging.GetWidth(ImageID)
Dim ImageHeight As Integer = oGdPictureImaging.GetHeight(ImageID)
Dim NewImage As Integer = oGdPictureImaging.CreateNewGdPictureImage(ImageWidth, ImageHeight, Imaging.PixelFormat.Format24bppRgb, Color.White)
oGdPictureImaging.DrawGdPictureImage(ImageID, NewImage, 0, 0, ImageWidth, ImageHeight, Drawing2D.InterpolationMode.NearestNeighbor)
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
'Step2: convert new bitmap to searchable PDF
oGdPictureImaging.ConvertTo1Bpp(NewImage) 'Comment this line to keep true colour PDF
Dim PdfID As Integer = oGdPictureImaging.PdfOCRStart("d:\out.pdf", True, "", "", "", "", "")
oGdPictureImaging.PdfAddGdPictureImageToPdfOCR(PdfID, NewImage, GdPicture.TesseractDictionary.TesseractDictionaryEnglish, "C:\Program Files\GdPicture.NET\Redist\Commons\OCR", "")
oGdPictureImaging.PdfOCRStop(PdfID)
oGdPictureImaging.ReleaseGdPictureImage(NewImage)

Gabriela
Posts: 436
Joined: Wed Nov 22, 2017 9:52 am

Re: EMF to Searchable PDF

Post by Gabriela » Fri May 17, 2019 2:16 pm

Hi,

Using the GdPicture14 version you can benefit from OCR features, which are included in the GdPicture PDF class directly:
OcrPage
OcrPages
Or you can use also the new GdPictureOCR class dedicated for OCR.
Give it a try!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest