public function testProxyBarcodeRendererDrawAsSvgAutomaticallyRenderSvgIfException() { Barcode\Barcode::setBarcodeFont(__DIR__ . '/Object/_fonts/Vera.ttf'); $resource = Barcode\Barcode::draw('code25', 'svg'); $this->assertTrue($resource instanceof \DOMDocument); Barcode\Barcode::setBarcodeFont(''); }
/** * This draws and optionally renders a barcode image * * @param string $strText The text to represent as a barcode * @param bool $blnRender * @return image */ public static function DrawBarcode($strText, $blnRender = false) { $arrBarcodeOptions = array('text' => $strText, 'font' => __INCLUDES__ . '/fonts/VeraMono.ttf'); // No required renderer options $arrRendererOptions = array(); if (!$blnRender) { // Draw the barcode and return the resource $imgResource = Barcode::draw('code128', 'image', $arrBarcodeOptions, $arrRendererOptions); return $imgResource; } else { // Draw the barcode in a new image, // send the headers and the image Barcode::render('code128', 'image', $arrBarcodeOptions, $arrRendererOptions); } }
public function testProxyBarcodeRendererDrawAsPdf() { Barcode\Barcode::setBarcodeFont(__DIR__ . '/Object/_fonts/Vera.ttf'); $resource = Barcode\Barcode::draw('code25', 'PDF'); $this->assertTrue($resource instanceof PDF\PDFDocument); Barcode\Barcode::setBarcodeFont(''); }