Exemplo n.º 1
0
 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('');
 }
Exemplo n.º 2
0
 /**
  * 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);
     }
 }
Exemplo n.º 3
0
 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('');
 }