Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bar Code Printing in Micro Size on Label

mstrcmtr

Programmer
Joined
Nov 14, 2007
Messages
106
Location
PK
Printer Name: 4BARCODE 4B-2054K

Problem: On Bar Code Printer print Bar Code sticker in Micro size

Using the following Code showing okay in Print Preview

Downloaded the Font Code128 and copy in C:\Windows\Fonts Folder

LOCAL lo_Fbc

lo_Fbc = CREATEOBJECT("FoxBarcode")

*-- Object Properties
WITH lo_Fbc

.cFontName = "Arial"

.cSet128 = "*"

.lFontBold = .T.
.nAlignText = 1

.nBarcodeType = 110

*.nFactor = 2

.nFontSize = 10.5
.nImageHeight = 40

.cText = "Code128"
* .cText = "Free3of9"
* .cText = "IDAutomationHC39M Free Version"
* .lShowHumanReadableText = .F.
ENDWITH

ln_Chk_P_No = 1
ln_Chk_Rctngl_Box = 1

CREATE CURSOR Tc_Bar_C_2(Acitno I , PrtNo C(16) , Bar_C_13 C(13) )

INSERT INTO Tc_Bar_C_2 VALUES (42 , '1ARO WATER SWIWW' , '0000000000042' )

SELECT Tc_Bar_C_2

GO TOP IN Tc_Bar_C_2

LABEL FORM Item_Stckr_Qih_038_W_25_H_LO_1.Lbx TO PRINTER PROMPT PREVIEW

CLOSE ALL

CLEAR ALL

RETURN
 
Ok, and what is the problem?
From your description, it is not clear to me whether you want to print in MicroSize or whether your printout is too small.
If the latter, there was a problem with VFP reports and a screen-scaling different from 100%. Check your windows settings.
Also: what is your setting for SET REPORTBEHAVIOR? 80 or 90 ?
And why would you need that FONT128 in your Windows directory? That FoxBarcode class generates the whole image, no need for a special font.
Where are you generating that image with the "loFbc.BarcodeImage(Tc_Bar_c_2.Bar_C_13) " code?

BTW: That "SELECT TC_Bar_C_2" isn't necessary, because you are already focussed on that just created cursor.
That "GO TOP" is also not necessary, since any table-related command without a FOR condition will always start from top.
 
Last edited:
Sorry

I illustrate my problem

Bar Code and other controls all are Printing in a Micro size instead of Normal viewable Size like showing in Print Preview of Label

Using

SET REPORTBEHAVIOR 90

For this
lo_Fbc.BarcodeImage(Tc_Bar_c_2.Bar_C_13)

I have attached label file in which you check command in a Picture/Ole Bound control
with scale contents , retain shape in General Tab of Ole control
 

mstrcmtr:​

  • Do you use VFP 9 or VFP A?

  • What is DPI size (text size in windows - 100%, 120%, 150%, 175% or custom size)?

MartinaJ
 
I have attached label file in which you check command in a Picture/Ole Bound control
with scale contents , retain shape in General Tab of Ole control
Hmm, I don't see anything attached ?
 
I am using VFP9 with SP2

attaching a Zip file containing Prg and Label files

Display set to

Scale 100%
Display resolution 1600 * 900
Display Orientation Landscape
 

Attachments

Preview zoomed to 300%:
1751364072937.png

Screenshot of PDF viewer in 300% zoom:
1751364131095.png
Same, same - except a bit of quality difference mainly in the numeric part of the barcode graphic, a bit blurry barcode lines, too. I guess this would be controllable by quality settings of the PDF conversion. I just used the Microsoft Print To PDF for this. But I don't see a general problem like much smaller barcode graphics in the PDF than in preview. Or is it that you want higher barcodes so the frame is fully filled? Then just increase the .nImageHeight to something higher.

Also, try with different printers to see if the problem isn't in your printer settings.
 
Last edited:
Printer Name: 4BARCODE 4B-2054K

Problem: On Bar Code Printer print Bar Code sticker in Micro size

Using the following Code showing okay in Print Preview

Downloaded the Font Code128 and copy in C:\Windows\Fonts Folder

LOCAL lo_Fbc

lo_Fbc = CREATEOBJECT("FoxBarcode")

*-- Object Properties
WITH lo_Fbc

.cFontName = "Arial"

.cSet128 = "*"

.lFontBold = .T.
.nAlignText = 1

.nBarcodeType = 110

*.nFactor = 2

.nFontSize = 10.5
.nImageHeight = 40

.cText = "Code128"
* .cText = "Free3of9"
* .cText = "IDAutomationHC39M Free Version"
* .lShowHumanReadableText = .F.
ENDWITH

ln_Chk_P_No = 1
ln_Chk_Rctngl_Box = 1

CREATE CURSOR Tc_Bar_C_2(Acitno I , PrtNo C(16) , Bar_C_13 C(13) )

INSERT INTO Tc_Bar_C_2 VALUES (42 , '1ARO WATER SWIWW' , '0000000000042' )

SELECT Tc_Bar_C_2

GO TOP IN Tc_Bar_C_2

LABEL FORM Item_Stckr_Qih_038_W_25_H_LO_1.Lbx TO PRINTER PROMPT PREVIEW

CLOSE ALL

CLEAR ALL

RETURN
I'm not familiar with the Label Form command, nor with the 'FoxBarcode' object.
However we have been using IDAutomation fonts (I25, C39, etc.) for shipping labels for decades, since the FoxBase days; and the same coding is working with VFP 9.0 now (we do have a paid version of IDAutomation font set)
What we do is format the label with the standard Report Form, bind the report to the destination label printer, and simply set the field to be barcoded (Item#, PO#,etc) to the proper IDAutomation font (which will appear in style pick list along with all other fonts); and it runs just like any other report forms.

Hope this helps.
 
As an additional possibility: have you downloaded the newest printing apps?
There have been several cumulative updates, and this one could fit your problem:
"2014.07.04 Release This release fixes a bug in ReportOutput.app and ReportBuilder.app that didn't handle higher DPI displays properly"

https://github.com/VFPX/ReportingApps
Click on that green "Code" button and then "Download ZIP"
 
Steve, labels are in fact quite the same as reports, just with lbx file extension and by default a format that fits label sheets. with several columns and rows. The designer designs one label of a sheet only. Many use endless paper labels instead of sheets when it comes to mass label printing and then it means one column of labels. Anyway, technically label and report are quite the same.

And they are also handled by the report apps and reportengine setting 80 or 90.

FoxBarcode is part of VFPX: https://github.com/VFPX/FoxBarcode
 
Chriss,

Thanks for the explanation.
Still not sure how settings defined under FoxBarcode object link to the Label command.
Regardless, that's a lot of extra steps which can be done in the standard Report form.
We have labels of various sizes and some applications require printing of batch of over one thousand labels (sometimes we had to break it up - labels saved as PDF first - so the poor label printer won't overheat and hang). None the less, the stock VFP report forms have all we needed and perform well.

Steve Yu
 
Still not sure how settings defined under FoxBarcode object link to the Label command.
Not at all, the FoxBarCode library creates an image based on the properties given, i.e. using Arial font within the image. For the report or label it only is an image, doesn't matter what's in it. The image size should just depend on the settings of the report picture/olebound control regarding scale contents / retain shape and that's ok. I didn't need to fix anything to get mstrcmtr label (report) going and I don't see a problem.

Stve, you could, if you want confirm this by installing FoxBarCode, now you know where to find it. The label lbx/lbt files and prg attached by mstrcmtr then work provided you adjust paths, perhaps.

So, actually, there is no problem. The problem might be in not using the latest fixed and SP2 versions of the report apps (they also preview and print label files).
 
Not at all, the FoxBarCode library creates an image based on the properties given, i.e. using Arial font within the image. For the report or label it only is an image, doesn't matter what's in it. The image size should just depend on the settings of the report picture/olebound control regarding scale contents / retain shape and that's ok. I didn't need to fix anything to get mstrcmtr label (report) going and I don't see a problem.

Stve, you could, if you want confirm this by installing FoxBarCode, now you know where to find it. The label lbx/lbt files and prg attached by mstrcmtr then work provided you adjust paths, perhaps.

So, actually, there is no problem. The problem might be in not using the latest fixed and SP2 versions of the report apps (they also preview and print label files).
What is the disadvantage of building the label with standard VFP report form ?
To me the FoxBarCode's approach is going the long route: how would I know all the settings (cset128 = '*', label type, etc) when I can easily create the label with the report form ?
Just curious.
 
You're still not getting the role of foxbarcode, it's not to create a label or report, just an image. That's used as the value for a picture/olebound control. And indeed, that can be in a label or a report, doesn't matter. foxbarcode is not fixated on labels. Labels just make printing label sheets much easier than a report, no matter whether the labels contain barcodes or any picture at all or not.
 
You're still not getting the role of foxbarcode, it's not to create a label or report, just an image. That's used as the value for a picture/olebound control. And indeed, that can be in a label or a report, doesn't matter. foxbarcode is not fixated on labels. Labels just make printing label sheets much easier than a report, no matter whether the labels contain barcodes or any picture at all or not.
So the label command requires an image to work, as opposed to report form which can generate a label with or without a pre-made image ?
 
No. Your only solution seems to be a barcode font instead of creating barcode images. Well, that can be used in context with a label too, A label is just a specialized form of a report. But there's no need for a barcode font when you use the foxbarcode library.

The LABEL FORM command mstrcmtr uses previews and prints his Item_Stckr_Qih_038_W_25_H_LO_1.Lbx label file. as you could also get from the attached download including that and code in post #6 (the attachment doesn't include foxbarcode, but you know where to get that from). Complex name for the label file, but so be it. There's a call within the label definition that generates the barcode images on the fly from the barcode values to be printed coming from data. There's no prerun, no 2 pass process. And though it's called label (singular) it prints as many labels as you feed data into it. So what you see is a mirage, there's none of the problems you address. It's all working out, as I demonstrate with my screenshots. What doesn't work for mstrcmtr must have to do with his settings or outdated report apps of VFP9. There's no need for any alternative, except perhaps upgrading that.
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top