Hi,
You don't need to create a temporary image, there is a PDF renderer:
$pdf = new Zend_Pdf();
... // your work
$barcodeOptions = array('text' => 'MY-TEXT', 'font' =>
'path/to/my-font.ttf');
$rendererOptions = array();
$pdfResource = Zend_Barcode::factory('code39', 'pdf', $barcodeOptions,
$rendererOptions)->setResource($pdf)->draw();
Mickaël
Le 12/02/2010 13:31, rpsimao a écrit :
Found the solution.
Must create a image and pass to the Zend_Pdf_Image::imageWithPath() method.
so :
// Only the text to draw is required
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');
// No required options
$rendererOptions = array();
// Draw the barcode in a new image,
$imageResource = Zend_Barcode::draw(
'code39', 'image', $barcodeOptions, $rendererOptions
);
imagejpeg($imageResource, 'barcode.jpg', 100);
// Free up memory
imagedestroy($imageResource);
$image = Zend_Pdf_Image::imageWithPath('barcode.jpg');
...
$page->drawImage($image, $x1, $y1, $x2, $y2);
...