Page 1 of 1

[VB6 Interop] SaveAsPDFOCR and COM interop

Posted: Wed Jun 24, 2009 4:38 pm
by sbarlow
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:

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
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

Re: [VB6 Interop] SaveAsPDFOCR and COM interop

Posted: Thu Jun 25, 2009 10:44 am
by Loïc
Hi,

I've been able to run your code into the vb IDE without any problem.

I suspect that your imagepath path = "App.Path & "\sp.tif"". I replaced it by "c:\test.tif" for my tests.

Kind regards,

Loïc

Re: [VB6 Interop] SaveAsPDFOCR and COM interop

Posted: Thu Jun 25, 2009 9:25 pm
by sbarlow
I think this is due to me running VB6 on Vista

Re: [VB6 Interop] SaveAsPDFOCR and COM interop

Posted: Fri Jun 26, 2009 2:04 pm
by Loïc
Hi,

Not sure... I made the test under Vista. maybe you have not the latest service pack of vb6 ?

Kind regards,

Loïc