[VB6 Interop] SaveAsPDFOCR and COM interop
Posted: Wed Jun 24, 2009 4:38 pm
If run into a weird situation using the two methods that create a PDF/OCR when using VB6 and the modules registered with regasm. If i try to run the project from inside the VB IDE (debugging) I get the following error.
OCR: Value cannot be Null
Parameter name: PTR
The PDF is created, but no OCR
However, if I compile it and run the resulting executable, it works fine, and the PDF is created with OCR.
Code:
Additional Note... when registering with regasm, I add the /codebase switch , otherwise you end up with a file not found error when running the applicatoin
usage: regasm GdPicture.NET.dll /codebase /tlb
OCR: Value cannot be Null
Parameter name: PTR
The PDF is created, but no OCR
However, if I compile it and run the resulting executable, it works fine, and the PDF is created with OCR.
Code:
Code: Select all
Private Sub gdnet_Click()
Dim PDF As New GdPicture_NET.GdPictureImaging
PDF.SetLicenseNumber ("replaced")
PDF.SetLicenseNumberOCRTesseract ("replaced")
Dim imageid As Long
Dim imagepath As String
imagepath = App.Path & "\sp.tif"
imageid = PDF.CreateGdPictureImageFromFile(imagepath)
Debug.Print PDF.SaveAsPDFOCR(imageid, App.Path & "\sp.pdf", TesseractDictionary_TesseractDictionaryEnglish, App.Path & "\ocr", "", True, "", "", "", "", "")
PDF.ReleaseGdPictureImage (imageid)
End Sub
usage: regasm GdPicture.NET.dll /codebase /tlb