本文整理匯總了PHP中Zend\Barcode\Barcode::draw方法的典型用法代碼示例。如果您正苦於以下問題:PHP Barcode::draw方法的具體用法?PHP Barcode::draw怎麽用?PHP Barcode::draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Barcode\Barcode
的用法示例。
在下文中一共展示了Barcode::draw方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testProxyBarcodeRendererDrawAsSvgAutomaticallyRenderSvgIfException
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('');
}
示例2: DrawBarcode
/**
* 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);
}
}
示例3: testProxyBarcodeRendererDrawAsPdf
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('');
}