Skip to Content
avatar image
Former Member

How to allign text under the barcode with same width?


I need to put a barcode in my form with the human readable text right under it and more importantly,irrespective of the number of digits of the text number, it needs to be space out exactly equal to the barcode length.can anyone please help with text formatting here? And what if the barcode might change in future? Something like below:


1 2 3 4 5 6 7



Edited by: Aditi Bhandari on Nov 22, 2009 3:38 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 11, 2009 at 05:40 AM

    You can create 10 column template which come equi spaced automatically. After putting some logic based on number of digits in your value( suppose u have material number), you can set which value wil appear in which box.

    i.e material number - 10 numbers length

    i.e material number - 9 numbers length

    so based on number of digits place them in respective column of template.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 22, 2009 at 05:14 PM

    For sapscripts and smart forms (what is your techno?), SAP allows you only to print barcodes (bars), not the texts corresponding to these barcodes, so you will have to implement a custom solution.

    As SAP doesn't provide you the actual width of the generated barcode, you will have to determine empirically the formula.

    I think it will be rather tough to use "space" characters or font size to manage the spacing between characters.

    Instead, I see 2 solutions:

    - send directly the text to the printer with the right Character Per Inch value : First calculate how many characters per inch you need (barcode estimated width divided by number of characters), then use print controls HEX - ENDHEX to define the instructions in printer language (for each device type you will print to). For better rendering use fixed font (COURIER, etc.) Note that it will work for printout, but not for print preview (text won't appear at all).

    - second solution would be to generate text as an image if you have such a software, and print the image. It will work well in all situations.

    Add comment
    10|10000 characters needed characters exceeded