2012-01-28 7 views
2

ラベルに正しい余白が印刷されたバーコードを使用してPDFページを作成しようとしています(バーコードをPDF生成せずにラベルに印刷する方法がある場合は、 dはそれを聞くのが大好きです)。以下は、私は現在のコードのためにしたものである: ":)(ライン79上のライブラリ/ Zendの/ PDF/FileParserDataSource/File.phpに無効なファイル・パス"Zend FrameworkレンダリングバーコードをPDFページに埋め込む

$pdf = new Zend_Pdf(); 
for($i = 1; $i <= $numberOfPages; $i++) 
{ 
    $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4); 
    $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 20); 
    $pdf->pages[] = $page; 
} 
foreach($pdf->pages as $id => $page) 
{ 
    if($equipmentCount > 10) 
    { 
    $barcodesOnThisPage = 10; 
    $equipmentCount = $equipmentCount - 10; 
    } 
    else 
    { 
    $barcodesOnThisPage = $equipmentCount; 
    } 
    for($i = 1; $i <= $barcodesOnThisPage; $i++) 
    { 
    //Zend_Barcode::setBarcodeFont(); 
    $barcodeOptions = array('text' => 'ZEND-FRAMEWORK-1'); 
    $rendererOptions = array('topOffset' => 50); 
    $pdf = Zend_Barcode::factory('code39', 'pdf', 
    $barcodeOptions, $rendererOptions)->setResource($pdf)->render(); 
    die; 
    $barcodeOptions = array('text' => 'ZEND-FRAMEWORK-2'); 
    $rendererOptions = array('topOffset' => 100); 
    $pdfBarcode = Zend_Barcode::factory('code39', 'pdf', 
    $barcodeOptions, $rendererOptions)->setResource($pdf)->draw(); 
    $barcodeOptions = array('text' => 'ZEND-FRAMEWORK-3'); 
    $rendererOptions = array('topOffset' => 150); 
    $pdfBarcode = Zend_Barcode::factory('code39', 'pdf', 
    $barcodeOptions, $rendererOptions)->setResource($pdf)->draw(); 
    // and the end render your Zend_Pdf 
    /$pdfBarcode->save('testBarcode.pdf'); 
    } 
} 

私は現在、エラーを取得していますなぜこれが起こっているのかについての考えはありますか?これは、バーコードをレンダリングしようとすると発生します。その前にコードはエラーなしで実行されます。

+1

ライン79一つですZend_Barcode::factory('code39', 'pdf', $barcodeOptions, $rendererOptions)->setResource($pdf, $page_index)->draw();のようなものを使用してPDFのページにバーコードライブラリのバーコードを印刷しますか? – ACNB

+0

Line 79は、Zend_Barcode :: factoryのrender()を呼び出す行です。 – tubaguy50035

答えて

1
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK-1', 'font' => __DIR__ . "/FRE3OF9X.TTF"); 

TTFファイル(FRE3OF9X.TTFか何を持っている)が存在しなければなりません。

+0

通常、バーコードの下でレンダリングされるテキストを読み込む方法はありますか?今はバーコードです。 – tubaguy50035

+0

私はあなたの例であなたと同じttfを使用しています – tubaguy50035

+1

Err、私は知らない。私はそれを前にやったことはありません。質問はちょうど私の目を引っ張った。たぶん別のTTFを試してみるべきでしょう。しかし、私はそれについては分かりません。 – akond

2

私はあなたの質問に完全な答えは以来、ここに追加されたことを信じている: Zend Framework Render Barcodes Into Multiple PDF Pages with other content

鍵があるように思わ:

  1. ページのPDFライブラリページのコンテンツを作成します。
  2. pdfライブラリページをpdfに追加してください。
+0

ありがとう!間違いなくそれをチェックしなければならない。 – tubaguy50035

関連する問題