0

以下のコードはサンプルであり、機能します (ファイルから pdf をロードし、単一の文字列を描画します、成功)。 firefox、ファイルが見つかりません。

    <?php
   header("Content-Type: application/x-pdf");
   //header("Content-Disposition: attachment; filename=invoice-". date("Y-m-d-H-i") . ".pdf");
   header("Cache-Control: no-cache, must-revalidate");

   require_once 'zendframework/library/Zend/Loader/Autoloader.php';
   //Zend_Loader::registerAutoload();   

   $loader = Zend_Loader_Autoloader::getInstance();

   // load the invoice

   $invoice = Zend_Pdf::load("invoice.pdf");
   $page = $invoice->pages[0];


   $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);

   $page->setFont($font, 12);

   // invoice information*/
   $page->drawText('success ', 420,642);

   // output the PDF
   echo $invoice->render();
?>

ファイル名が変更されたコード:

    <?php
   header("Content-Type: application/x-pdf");
   //header("Content-Disposition: attachment; filename=invoice-". date("Y-m-d-H-i") . ".pdf");
   header("Cache-Control: no-cache, must-revalidate");

   require_once 'zendframework/library/Zend/Loader/Autoloader.php';
   //Zend_Loader::registerAutoload();   

   $loader = Zend_Loader_Autoloader::getInstance();

   // load the invoice

   $invoice = Zend_Pdf::load("buyersguide.pdf");
   $page = $invoice->pages[0];


   $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES_BOLD);

   $page->setFont($font, 12);

   // invoice information*/
   $page->drawText('success ', 420,642);

   // output the PDF
   echo $invoice->render();
?>

バイヤーズ ガイドの PDF は、政府の Web サイトから取得したものです。PDF は Adob​​e Reader で正常に読み込まれます。バイヤーズガイド PDF: http://www.consumer.ftc.gov/articles/pdf-0083-buyers-guide.pdf

4

1 に答える 1