BarCodeGetWidth128

Discussions about image processing and document imaging.
Post Reply
issacsim
Posts: 7
Joined: Wed Aug 15, 2007 5:06 pm

BarCodeGetWidth128

Post by issacsim » Tue May 01, 2012 8:47 pm

This method is listed in the help file, but when I try to use it I get an OLE Error for unknown name.

I am trying to create a barcode image in VFP and need to set the image to the correct width.

Parameters lcCode, cNewFileName
oDGPicture = Createobject("gdpicturepro5.imaging")
oDGPicture.SetLicenseNumber("MyLicCode")
nWidth = oDGPicture.BarCodeGetWidth128(lcCode, 40) && Breaks here
oDGPicture.CreateNewImage((nWidth + 5), 50, 32, 16777215)
oDGPicture.BarCodeDraw128(lcCode, 5, 5, 40)
oDGPicture.SaveAsJpeg(LOWER(cNewFileName),100)
Release oDGPicture

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

Re: BarCodeGetWidth128

Post by Loïc » Tue May 01, 2012 8:59 pm

Hello,

Your code works fine for me under vfp9. Are you using the latest version ?
You can get it from : https://www.gdpicture.com/download/legacy/v5/

Kind regards,

Loïc

issacsim
Posts: 7
Joined: Wed Aug 15, 2007 5:06 pm

Re: BarCodeGetWidth128

Post by issacsim » Thu May 03, 2012 4:21 pm

Thank you, I don't get the OLE error, but width always returns 0?

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

Re: BarCodeGetWidth128

Post by Loïc » Thu May 03, 2012 4:55 pm

Could you provide a code snippet to reproduce the problem ?

issacsim
Posts: 7
Joined: Wed Aug 15, 2007 5:06 pm

Re: BarCodeGetWidth128

Post by issacsim » Thu May 03, 2012 8:38 pm

Same as above,

oDGPicture.BarCodeGetWidth128(lcCode, 40) returns zero

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

Re: BarCodeGetWidth128

Post by Loïc » Thu May 03, 2012 8:47 pm

ok but what is the content of the lcCode variable ?

issacsim
Posts: 7
Joined: Wed Aug 15, 2007 5:06 pm

Re: BarCodeGetWidth128

Post by issacsim » Fri May 04, 2012 3:42 pm

Anything, use any text value. I tried "TestBarcode" as my variable.

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

Re: BarCodeGetWidth128

Post by Loïc » Fri May 04, 2012 5:34 pm

ok I see. You have to handle an image prior getting a barcode width.

IE:

oDGPicture.CreateNewImage(1, 50, 32, 16777215)
nWidth = oDGPicture.BarCodeGetWidth128(lcCode, 40)

issacsim
Posts: 7
Joined: Wed Aug 15, 2007 5:06 pm

Re: BarCodeGetWidth128

Post by issacsim » Fri May 04, 2012 9:39 pm

Works, thanks.

But I am getting a black image now since I upgraded, any ideas?

Parameters lcCode, cNewFileName
oDGPicture = Createobject("gdpicturepro5.imaging")
oDGPicture.SetLicenseNumber("MyCode")
oDGPicture.SetVerticalResolution(300)
oDGPicture.SetHorizontalResolution(300)
oDGPicture.CreateNewImage(200, 50, 32, 16777215)
nWidth = oDGPicture.BarCodeGetWidth128(lcCode, 40) + 5
oDGPicture.ResizeImage(nWidth, 50)
oDGPicture.BarCodeDraw128(lcCode, 5, 5, 40)
oDGPicture.SaveAsJpeg(LOWER(cNewFileName),100)
Release oDGPicture

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

Re: BarCodeGetWidth128

Post by Loïc » Fri May 04, 2012 10:03 pm

replace 16777215 by a proper color value. IE: ARGB(255,255,255,255)

issacsim
Posts: 7
Joined: Wed Aug 15, 2007 5:06 pm

Re: BarCodeGetWidth128

Post by issacsim » Mon May 07, 2012 6:35 pm

Works, thanks.

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

Re: BarCodeGetWidth128

Post by Loïc » Mon May 07, 2012 9:04 pm

You're welcome !

Thank you for the return.

Regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests