C.Jacobs
C.Jacobs

Reputation: 85

Get 2D barcode in TCPDF html table

Im trying to get a 2D barcode (QR) in a HTML table. I got the following code:

$style = array(
    
    'vpadding' => 'auto',
    'hpadding' => 'auto',
    'fgcolor' => array(0,0,0),
    'bgcolor' => false, //array(255,255,255)
    'module_width' => 1, // width of a single module in points
    'module_height' => 1 // height of a single module in points
);

$pdf->write2DBarcode('http://localhost/VERP/logistics/view_warehouse.php?id='.$warehouse->wa_id.'', 'QRCODE,L', 20, 30, 50, 50, $style, 'N');

// Set some content to print
$html = <<<EOD
<table border =".5" style="line-height:20px; width:100%;">
<tr>
<td style="height:490px">test</td>
</tr>
</table>
<table border =".5" style="line-height:20px; width:100%;">
<tr>
<td style="height:490px">test</td>
</tr>
</table>
EOD;

// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);

The goal is to get the QR code inside the html table.

I tried the example 49 from TCPDF but i keep getting the error message with only changing the include file name from 'tcpdf_include.php' to 'tcpdf.php':

"TCPDF ERROR: Some data has already been output, can't send PDF file"

Upvotes: 1

Views: 1413

Answers (1)

C.Jacobs
C.Jacobs

Reputation: 85

Found the answer. Was searching for the wrong thing. Answer: TCPDF ERROR: Some data has already been output, can't send PDF file

Used example 49 from TCPDF and added ob_end_clean(); before the output.

Upvotes: 2

Related Questions