I'm using your sample code for creating a pdfseacheable from an existing pdf and it works.
My application monitoring a folder and convert the pdf files to pdf searchable. In this folder there are pdf not searchable.
But, the new pdf has a size major then the original pdf.
Can I reduce more the size of the resultant pdftext? It is an essential requirement to reduce the size of the file for the client.
Thanks,
SOFTWARE:
Microsoft Visual Studio 6.0 (SP6) : Microsoft Visual Basic 6.0
gdpicturepro5.ocx (product version: 5.12.0006 ; product name: GdPicture Pro 5 - Imaging ToolKit )
CODE USED:
- Code: Select all
Public Function PdfToPdfText(ByRef sError$, ByVal sLicense$, ByVal sPathOCRData$, ByVal iTesseractDictionary%, ByRef sPdfIn$, ByVal sPdfText$) As Boolean
Dim bRet As Boolean
Dim nPage As Long
Dim oImaging As Object, oGdViewer As Object
Dim RasterizedPage As Long
Dim lCompression As Long
Dim lCompressioncambiada As Long
On Error GoTo Error:
bRet = True
Set oImaging = CreateObject("gdpicturepro5.Imaging")
Set oGdViewer = CreateObject("gdpicturepro5.GdViewer")
oGdViewer.SetLicenseNumber (sLicense)
oImaging.SetLicenseNumber (sLicense)
oImaging.SetLicenseNumberOCRTesseract (sLicense)
oGdViewer.LockControl = True
oGdViewer.PdfDpiRendering = 200
oGdViewer.DisplayFromPdfFile (sPdfIn)
oImaging.PdfSetJpegQuality (5)
oImaging.TwainPdfOCRStartEx (sPdfText)
For nPage = 1 To oGdViewer.PageCount
oGdViewer.DisplayFrame (nPage)
RasterizedPage = oGdViewer.GetNativeImage
Call oImaging.TwainAddGdPictureImageToPdfOCR(RasterizedPage, iTesseractDictionary, sPathOCRData) 'OCRData includes dictionary files
Call oImaging.OCRTesseractClear
Next nPage
oImaging.TwainPdfOCRStop
oGdViewer.CloseImage
PdfToPdfText = bRet
Exit Function
Error:
sError = Err.Description
PdfToPdfText = False
End Function
