Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

Draw text under a barcode

Question

How do I draw text underneath a barcode?

Answer

Currently only the EAN-13 barcode in Quick PDF Library draws the text at the bottom (it has to line the text up very carefully). For the other barcode types no text is drawn. This is by design as it is quite tough to get the text in a position that would suit all customers.

However, here is some sample code in Delphi that lets you draw text underneath a barcode. It can be modified as required to accommodate everyones needs.

// Add the Helvetica standard font
QP.AddStandardFont(4);

// Get the width of the barcode with a bar width of 1 unit
BarcodeWidth := QP.GetBarcodeWidth(1, '12345', 1);

// Draw the barcode
QP.DrawBarcode(100, 500, BarcodeWidth, 100, '12345', 1, 0);

// Center the text
QP.SetTextAlign(1);

// Draw the text at 10pt
QP.SetTextSize(10);
QP.DrawText(100 + BarcodeWidth / 2, 500 - 200 - 5 - QP.GetTextHeight, '12345');

© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum