Barcode Code-128 Aspect ratio

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Barcode Code-128 Aspect ratio

Postby EricH » Tue Aug 10, 2010 5:08 pm

I suspect this is user error, but I'm struggling with printing a barcode in VPE 6.00, and hoped you might give me some feedback.

The error is that the clear text is badly squashed, so that the clear text numbers are squashed together.

I suspect my aspect ratio is off, although I'm converting this from old code which was working in version 3, so I'm unsure what might have changed.

The current code (with variables substituted):

Code: Select all
vpe.Barcode(2.8, 3.65, 7.25, 5.05, BarcodeType.Code128, "01010000102220000017", String.Empty);


Old code:

Code: Select all
vpe.BarCode( 280, 365, 725, 505, BCT_CODE128C, lcTNStr , 0)


When I change the width to a negative number, the barcode width expands, and the clear text is no longer squashed.

Can you confirm my suspicion that this is an aspect ratio problem, and suggest any solutions or reasons that this might be different between versions? Is there any way to control the font size of the clear text or scale the barcode to still fit within the rectangle provided?

(I'd attach a screenshot of the problem, but don't see an easy way to do so.)
EricH
 
Posts: 4
Joined: Tue Aug 10, 2010 4:44 pm

Postby IDEAL Software Support » Wed Aug 11, 2010 12:35 pm

VPE's embedded barcode library had been exchanged with v3.20, released in March 2001. Since then nothing was changed on the text handling for barcodes. Therefore I assume you are talking about a version prior to v3.20.

The way the barcode library positions barcode text can not be changed. The font can be selected (for example OCR-A), but not the font size, which is choosen automatically.

In you case the barcode is just too dense to layout the characters correctly. If this happens on the screen-preview, try to print the barcode, there might be differences due to the low resolution of the preview. There is a chance the characters do not overlay when printed.

If the printed output is not ok:
Solution 1: Make the barcode wider.

Solution 2 (not recommended): Hide the text drawn by the library and draw the text yourself.
IDEAL Software Support
 
Posts: 1622
Joined: Thu Nov 18, 2004 4:03 pm

Postby EricH » Wed Aug 11, 2010 4:03 pm

It turns out setting the FontSize property does seem to scale the clear text (only).

I'm embarassed that I didn't try that before, but the old code was not doing so, and I assumed that barcodes were a special case that would need their own setting. :oops:
EricH
 
Posts: 4
Joined: Tue Aug 10, 2010 4:44 pm

Postby IDEAL Software Support » Wed Aug 11, 2010 5:15 pm

The FontSize property works for barcodes? In this case we have to update the manuals. :)
IDEAL Software Support
 
Posts: 1622
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 52 guests

cron