Exemplo n.º 1
0
/* This is where font/image/PDF input files live. Adjust as necessary. */
$searchpath = "../data";
$p = PDF_new();
/* create a new PDFlib object */
PDF_set_parameter($p, "SearchPath", $searchpath);
/*  open new PDF file; insert a file name to create the PDF on disk */
if (PDF_open_file($p, "") == 0) {
    die("Error: " . PDF_get_errmsg($p));
}
/* This line is required to avoid problems on Japanese systems */
PDF_set_parameter($p, "hypertextencoding", "winansi");
PDF_set_info($p, "Creator", "image.php");
PDF_set_info($p, "Author", "Rainer Schaaf");
PDF_set_info($p, "Title", "image sample (PHP)");
$imagefile = "nesrin.jpg";
$image = PDF_load_image($p, "auto", $imagefile, "");
if (!$image) {
    die("Error: " . PDF_get_errmsg($p));
}
/* dummy page size, will be adjusted by PDF_fit_image() */
PDF_begin_page($p, 10, 10);
PDF_fit_image($p, $image, 0, 0, "adjustpage");
PDF_close_image($p, $image);
PDF_end_page($p);
/* close page           */
PDF_close($p);
/* close PDF document   */
$buf = PDF_get_buffer($p);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: {$len}");
    while ($runrows = mysqli_fetch_array($runquery)) {
        $debit_card = $runrows['debit_card'];
        $amex_card = $runrows['amex_card'];
        $visa_card = $runrows['visa_card'];
        $total_staff_salary = $runrows['total_staff_salary'];
        $phone_bill = $runrows['phone_bill'];
        $rent_bill = $runrows['rent_bill'];
        $electricity_bill = $runrows['electricity_bill'];
        $director_fee = $runrows['director_fee'];
        $date = $runrows['date'];
        $desc = $runrows['desc'];
        $total_amount = $runrows['total_amount'];
        $consignment_payment = $runrows['consignment_payment'];
    }
}
$images = PDF_load_image($pdf, 'jpeg', 'C:\\xampp\\htdocs\\fyp2\\images\\dulce.jpeg', '');
$header = " EXPENDITURE REPORT ";
$timestamp = getdate();
$reference = "REF-" . $expenditure_id;
//get selected date
$selecteddate = $date;
// get generate option
$generateby = "MONTH";
$reportl2 = "FROM SELECTED DATE:      " . $selecteddate;
$date = "DATE";
$description = "DESCRIPTION";
$amount = "AMOUNTS S(\$)";
$line = "____________________________________________________________________________________________";
$debit = "DEBIT CARD: ";
$amex = "AMERICAN EXPRESS CARD: ";
$visa = "VISA CARD: ";
Exemplo n.º 3
0
 function writeBlock()
 {
     // テンプレートを使用する
     if (!file_exists($this->pdfpath)) {
         return;
     }
     // 既存PDFのドキュメントを取得
     $doc = pdf_open_pdi($this->pdf, $this->pdfpath, NULL, 0);
     // 既存PDFのドキュメントから指定ページを取得
     $page = pdf_open_pdi_page($this->pdf, $doc, 1, NULL);
     // ページを開く
     $this->openPage();
     // 既存PDFのページを割り当てる
     PDF_fit_pdi_page($this->pdf, $page, 0, 0, "adjustpage");
     // テキストブロックの書き込み
     $max = count($this->arrText);
     for ($i = 0; $i < $max; $i++) {
         foreach ($this->arrText[$i] as $key => $val) {
             if ($val != "") {
                 // 文字コードの変換
                 mb_convert_variables($this->dst_code, $this->src_code, $val);
                 // 書き込み
                 $ret = PDF_fill_textblock($this->pdf, $page, $key, $val, $this->block_option);
             }
         }
     }
     // イメージブロックの書き込み
     $max = count($this->arrImage);
     for ($i = 0; $i < $max; $i++) {
         foreach ($this->arrImage[$i] as $key => $val) {
             if ($val != "") {
                 $img = PDF_load_image($this->pdf, "auto", $val, NULL);
                 $ret = PDF_fill_imageblock($this->pdf, $page, $key, $img, NULL);
             }
         }
     }
     // 割り当てたページを閉じる
     PDF_close_pdi_page($this->pdf, $page);
     // 割り当てたドキュメントを閉じる
     PDF_close_pdi($this->pdf, $doc);
 }