VFPX - FoxBarcode
VFPX - FoxBarcode
title=FoxBarcode
Register | Sign In
1 di 7 27/06/2011 07:31
VFPX - FoxBarcode http://vfpx.codeplex.com/wikipage?title=FoxBarcode
Home Downloads Documentation Discussions Issue Tracker Source Code People License
Show Page Comments | Print View | Page Info | Change History (all pages) Search Wiki & Documentation
Home FoxBarcode
FoxBarcode supports the following image types: JPG, BMP, GIF, PNG and TIFF
FoxBarcode generates the images with the class gpImage2 (http://sites.google.com/site/gpimage2) of Golovlev Alexander (Russia) and Cesar Chalom (Brazil), based
on GDI + and requires gdiplus.dll.
FoxBarcode is compatible with all versions of Visual FoxPro from version 6.0
Properties
FoxBarcode allows greater control over the generation of bar code image to be able to customize the following properties:
Methods
For the generation of the image, only one method should be called that generates the bar code image and returns the path and file name generated:
BarcodeImage(cTextToEncode, cFileNameImage, cPropertyList): Encodes the text and returns the file path of the bar code image generated.
Examples
The following is an example of code to generate an image type PNG barcode Code 128 C with a height of 100 pixels and a magnification factor 2
The new third parameter to the BarcodeImage() method, which allows you to configure the various properties, separated by commas. The same example as above,
with this new way.
2 di 7 27/06/2011 07:31
VFPX - FoxBarcode http://vfpx.codeplex.com/wikipage?title=FoxBarcode
To include a barcode on a form, you must insert an Image object. As the bar code image does not exist at design time, the Picture property takes the name of the
image when calling the BarcodeImage() method, for example from the Refresh method of form, as shown in the figure below:
To include a barcode on a report, you must insert an Image object and set the property with a call ControlSource BarcodeImage() method and is recommended to set
"contents Scale, Retain shape" if the image size differs from the frame.
Important: Before you run the report and create the object FoxBarcode, you must declare the variable as PRIVATE so that it has scope in the report, as follows:
3 di 7 27/06/2011 07:31
VFPX - FoxBarcode http://vfpx.codeplex.com/wikipage?title=FoxBarcode
PRIVATE poFbc
poFbc = CREATEOBJECT("FoxBarcode)
...
REPORT FORM MyReport
Distribution
The only files needed to be distributed to FoxBarcode function properly are:
FoxBarcode.prg
gpImage2.prg
These files are located in the Source folder included in the download file.
Before instantiating the class FoxBarcode, you must run the following statements:
Demo Form
With the download of FoxBarcode is a sample form, from which we can generate bar codes to our needs, and a builder of code, from which we can copy the
generated code to the clipboard ready for pasting into your application.
At the top of the form there are three tabs from which all properties are configured class FoxBarcode.
From the tab "Barcode properties" you enter the text to encode, the kind of symbolism and if FoxBarcode calculates the check digit. The dimensions of the image of
the bar code to configure: the magnification factor, the around margin barcode, the height of the image, and the ratio of narrow and wide bar (in the symbols that
allow for such variation) . The rotation of the bar code is also set from this tab, as well as some special properties of certain symbols.
When we go through the list of symbols, is a brief description of the selected symbols, valid characters and their more common.
On the tab "Human-readable properties" to configure the human-readable text, whether it will be shown, whether to display the check digit and if it shows the
characters of Start and End of the symbols. The font, justification, the size and color are set in this tab.
The tab "Image and colors" shows us the full name of the image file, this property can be passed as parameter or FoxBarcode class generates a random file name.
Here we set the image type, resolution (DPI), the background color and the color of the bars.
Once you've set the properties, you can click on the button "Script Builder" and FoxBarcode automatically generates the necessary code to cut and paste in your
application.
4 di 7 27/06/2011 07:31
VFPX - FoxBarcode http://vfpx.codeplex.com/wikipage?title=FoxBarcode
Acknowledgements
To our families.
To Cesar Chalom for your continued ideas and collaborations with their classes gpImage2 and FoxyPreviewer.
Comments
pepere_jack May 18 at 7:07 PM
Good work!
A suggestion: you could let the user specify the width of the generated image so we could get, for exemple, 200 pixel width barcode image no matther the actual
length of the barcode.
Thanks.
The online scan readers show the barcode in upper case. It must be my scanner. Thank you very much.
Fred Krampe
PRIVATE poFbc
poFbc = CREATEOBJECT("FoxBarCode")
poFbc.cImageType = "PNG"
poFbc.nBarcodeType = 110
poFbc.cSet128 = "B"
poFBC.nImageHeight=200
poFbc.nFactor = 3
lcImage = poFbc.BarcodeImage(upper(alltrim(Labels.Part)))
COPY FILE (lcImage) TO (JUSTFNAME(lcImage))
I copy the image file generated in the current directory and scan the image with the following online scanners:
. http://www.onlinebarcodereader.com
. http://zxing.org/w/decode.jspx
In all cases the reading is in uppercase. I think you scanner is configured to return the read string to lowercase. Please check this.
But, I have a problem with Code 128 B. It only seems to generate lowercase text. That is, my TextToEncode is in uppercase, and the human readable is in uppercase,
but when I actually print and scan it, the result is lower case. My code is:
===================================================
SET PROCEDURE TO LOCFILE("foxBarcode.PRG"),LOCFILE("gpImage2.prg") additive
PRIVATE poFbc
poFbc = CREATEOBJECT("FoxBarCode")
poFbc.cImageType = "PNG"
5 di 7 27/06/2011 07:31
VFPX - FoxBarcode http://vfpx.codeplex.com/wikipage?title=FoxBarcode
poFbc.nBarcodeType = 110
poFbc.cSet128 = "B"
poFBC.nImageHeight=203
poFBC.nResolution = 203
poFbc.nFactor = 3
poFbc.nmargin = 1
Any ideas?
Thanks,
Fred
To you I need to create in your form the oFBC property and the clause where you create the instance of the FoxBarcode class with CREATEOBJETC()
Ex:
ThisForm.oFBC = CREATEOBJECT("FoxBarcode")
What version of "FoxBarcode" are you using? That error was corrected in version 0.12 and was improved in version 0.13 (the current version is 0.14)
I'm using FoxBarcode 0.14 with VFP9 SP2 and Windows 7 64 bits without problems.
If even with the 0.14 version the problem continues, find the array "laListFontName" in "FoxBarcode.PRG" file and try changing some of the 10 names of fonts for
the names of fonts you have installed on your Windows.
Ej:
laListFontName(1) = "Calibri" && Old name = "Courier New"
Best Regards
Francis (French MVP VFP)
6 di 7 27/06/2011 07:31
VFPX - FoxBarcode http://vfpx.codeplex.com/wikipage?title=FoxBarcode
© 2006-2011 Microsoft | Get Help | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2011.5.24.17889
7 di 7 27/06/2011 07:31