[VB6 Interop] SaveAsPDFOCR and COM interop

Discussions about GdPicture.NET usage in non managed applications built in vb6, Delphi, vfp, MFC c++ etc...
Post Reply
sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

[VB6 Interop] SaveAsPDFOCR and COM interop

Post by sbarlow » 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:

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

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [VB6 Interop] SaveAsPDFOCR and COM interop

Post by Loïc » Thu Jun 25, 2009 10:44 am

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

sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

Re: [VB6 Interop] SaveAsPDFOCR and COM interop

Post by sbarlow » Thu Jun 25, 2009 9:25 pm

I think this is due to me running VB6 on Vista

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [VB6 Interop] SaveAsPDFOCR and COM interop

Post by Loïc » Fri Jun 26, 2009 2:04 pm

Hi,

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

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests