Esempio n. 1
0
 public function barcode($code, $type = 'code128')
 {
     if (!in_array($type, ['code128', 'code25', 'code25interleaved', 'code39', 'ean13', 'ean2', 'ean5', 'ean8', 'identcode', 'itf14', 'leitcode', 'planet', 'postnet', 'royalmail', 'upca', 'upce'])) {
         \App::abort(404);
     }
     //Barcode::setBarcodeFont( storage_path( 'pdf/fonts/yahei/normal.ttf' ) );
     $barcodeOptions = array('text' => $code, 'factor' => 1);
     $rendererOptions = array();
     Barcode::render($type, 'image', $barcodeOptions, $rendererOptions);
     $response = \Response::make('', 200);
     $response->header('Content-Type', 'image/png', true);
     return $response;
 }
Esempio 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);
     }
 }
Esempio n. 3
0
                     $key = 'seatId_' . $seatId;
                     //tmp key
                     $tmpArray->{$key} = $dtcmBarcode;
                     $zoneSeatsObj->setBarcode($dtcmBarcode);
                     $em->persist($zoneSeatsObj);
                     $em->flush();
                 }
             }
             $update = TRUE;
         } else {
             $dtcmError = TRUE;
         }
     }
 }
 //if dtcm error
 if ($dtcmError) {