Search code examples
phpbarcodempdfcode39

Barcode Generation (Code 39) MPDF


I'm able to generate a barcode by using the following code:

    $code = '12345';

Then to generate the barcode, I do the following:

   <barcode code="$code" type="C39" size="0.5" height="2.0" />

However, it is not generating the correct id. Is there something that I'm doing wrong? What I'm using is the mPDF tool, and I can't change to a different pdf tool.

Thank you..


Solution

  • It's hard to tell what syntax the two code snippets are in, but if that PHP variable needs to be printed in XML you need to specify that it is PHP:

    <barcode code="<?php echo $code; ?>" type="C39" size="0.5" height="2.0" />