Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

using barcode fonts within report writer

Locked
csnet
Posts: 11
Joined: Wed Sep 29, 2010 8:13 pm

using barcode fonts within report writer

Unread post by csnet »

Hi,
I need to display barcodes on my report.
I have downloaded some barcode fonts, and would like to know how to use them with nuBuilder report writer.
christopher
Posts: 2
Joined: Mon Jun 15, 2009 5:03 am

Re: using barcode fonts within report writer

Unread post by christopher »

Hi there csnet,

To use your barcode on a font, you need to select that font in the report writer. At the moment the report builder is limited to a limited set of fonts, based primarily on those that are available in FPDF. In the next release of nuBuilder this will be changing to use a dynamic list that can be updated in in the Lists screen. In the mean time, you can modify nureportbuilder.php as follows, starting from line 2053:

Code: Select all

    print "\nvar theFamily = new Array()\n";
    print "theFamily[0] = 'Arial'\n";
    print "theFamily[1] = 'Courier'\n";
    print "theFamily[2] = 'Georgia'\n";
    print "theFamily[3] = 'Impact'\n";
    print "theFamily[4] = 'Tahoma'\n";
    print "theFamily[5] = 'Times'\n";
    print "theFamily[6] = 'Verdana'\n";
    print "theFamily[7] = 'Symbol'\n";
    print "theFamily[8] = 'Webdings'\n";
    print "theFamily[9] = 'Wingdings'\n";
    print "theFamily[10] = 'YourBarcodeFontNameHere'\n"; //Use the file name of your font here     
Once that is done, the implementation depends on the format you want for your report.

HTML
All users who wish to print the report with barcodes must have the font installed on their computer, and it must have the same name on their system as you have given it in the code above. This works if your affected users are on a local intranet and you can easily install the font to their computers or make it available to them for download. If they don't have the font installed, their browser will just show the barcode as text in the default browser font.

PDF
For PDF reports you will need to create font definition and metrics files with fpdf/fonts/makefont/makefont.php. For detailed instructions on how to do this see this tutorial.

Producing the report
Once either of these is in place, just add a text field in the report builder and set the font to your barcode font. Finally, be aware that some barcode fonts require you to add some extra markup to the ends of your barcode number/string, such as exclamation marks or hashes, and filter out any other punctuation marks or spaces. You will need to add this in the SQL code that generates your report data, e.g.:

Code: Select all

SELECT 
   productID, 
   prdName, 
   prdDescription, 
   CONCAT('!',prdBarcode,'!') AS barcode
FROM product
I hope this helps!

Regards,

Christopher
csnet
Posts: 11
Joined: Wed Sep 29, 2010 8:13 pm

Re: using barcode fonts within report writer

Unread post by csnet »

Thanks lot Christopher,
I have implemented your solution and can print mailing labels with barcode no problem.
Keep it up.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: using barcode fonts within report writer

Unread post by admin »

.
Locked