Génération code barre
Posté : 20 mars 2007, 21:18
Bonjour,
peut-on généré des code barre type 39 avec php
merci pour info
peut-on généré des code barre type 39 avec php
merci pour info
Venez poser vos questions PHP, MySQL, HTML5, CSS, Javascript, Gestion de serveurs à la communauté PHPfrance
https://forum.phpfrance.com/
<?php
/*======================================================================
PDFBarcode Class - Usage example
http://www.grana.to/pdfbarcode
Copyright (C) 2004 Valerio Granato (valerio at grana.to)
Last Modified: 2005-04-07 09:25 CEST
Author: Valerio Granato (valerio at grana.to)
Version: 1.0
Package: PDFBarcode Class
Thanks to:
Tibor Thurnay <tibor.thurnay at swr3.de>
- genbarcode added to programs needed to run the example
- now barcodes can be rotated: 0°, 90°, 180°, 270°
A simple usage example - to use this example you NEED:
- GNU-Barcode
- Cpdf (see links above)
- genbarcode by by Folke Ashberg (http://www.ashberg.de/php-barcode/download/)
*/
include ('class.ezpdf.php');
include ('class.pdfbarcode.php');
$pdf =& new Cezpdf('a4', 'portrait');
$barcode_options = array (
'scale' => 1,
'fontscale' => 0,
'font' => './fonts/Helvetica.afm',
'rotation' => 0
);
$barcode = new PDFBarcode($pdf, $barcode_options);
for($codebarre=100000;$codebarre<100010;$codebarre++)
{
//$codebarredeb = '123456';
$fp=popen('genbarcode '.$codebarre.' 39', "r");
$bars=rtrim(fgets($fp, 1024));
$text= rtrim(fgets($fp, 1024));
$encoding=rtrim(fgets($fp, 1024));
pclose($fp);
if (ereg('^(EAN|ISBN|code 39)', $encoding)) { $fontscale = 4; } else { $fontscale = 0; }
$id = $barcode->generate($text, $bars, '320', '270', $fontscale);
$pdf->addObject($id);
$pdf->ezStream();
}
?>