Just installed the CakePDF plugin, and using TCPDF as the engine. Now I'm trying to write bar codes and QR codes, but nothing I've tried has worked.
I can get bar codes and qr codes to work if I use the TCPDF engine directly, but now that I'm trying to use the plugin, I'm not sure what to do other that just rewrite what I did with the engine directly... which makes me wonder what the point of the plugin would be then.
Am I missing something obvious? Can I create bar codes and qr codes via TCPDF if I'm using the CakePDF Plugin or should I just scrap the plugin and go directly w/ the engine?
The CakePDF plugin is a HTML to PDF wrapper, nothing more nothing less. Look at the source, it doesn't support all the nifty features of the individual PDF engines, it's purely "pass HTML to engine and return the output".
The point of the plugin is to integrate this easily with CakePHP views. If you need more control, then you'll usually need to to make use of the engines directly.
That being said, TCPDF supports a special <tcpdf>
tag to invoke methods via HTML, which might suit your needs.
Example:
<?php
$params = TCPDF_STATIC::serializeTCPDFtagParameters(array(
'CODE 39', 'C39', '', '', 80, 30, 0.4,
array(
'position' => 'S',
'border' => true,
'padding' => 4,
'fgcolor' => array(0,0,0),
'bgcolor' => array(255,255,255),
'text' => true,
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4
),
'N'
));
?>
<tcpdf method="write1DBarcode" params="<?php echo $params; ?>" />
See also TCPDF Examples: call TCPDF methods in HTML