本文整理汇总了PHP中PDF_get_buffer函数的典型用法代码示例。如果您正苦于以下问题:PHP PDF_get_buffer函数的具体用法?PHP PDF_get_buffer怎么用?PHP PDF_get_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PDF_get_buffer函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newpage
function newpage($closepage = true)
{
global $pdf;
if ($closepage) {
PDF_end_page($pdf);
/* Output the current part of the in-memory created PDF document */
print PDF_get_buffer($pdf);
}
/* Create a DIN A4 page */
PDF_begin_page($pdf, 595, 842);
return 812;
}
示例2: PDF_new
<?php
$p = PDF_new();
PDF_open_file($p);
PDF_begin_page($p, 595, 842);
$im = pdf_open_jpeg($p, "php-big.jpg");
pdf_place_image($p, $im, 200, 700, 1.0);
PDF_save($p);
// Save current coordinate system settings
$nx = 50 / PDF_get_value($p, "imagewidth", $im);
$ny = 100 / PDF_get_value($p, "imageheight", $im);
PDF_scale($p, $nx, $ny);
pdf_place_image($p, $im, 200 / $nx, 600 / $ny, 1.0);
PDF_restore($p);
// Restore previous
pdf_close_image($p, $im);
PDF_end_page($p);
PDF_close($p);
$buf = PDF_get_buffer($p);
$len = strlen($buf);
Header("Content-type:application/pdf");
Header("Content-Length:{$len}");
Header("Content-Disposition:inline; filename=coords.pdf");
echo $buf;
PDF_delete($p);
示例3: createPDF
public function createPDF($fname)
{
$pdf = pdf_new();
pdf_open_file($pdf, '');
$image = pdf_load_image($pdf, "png", $fname, "");
$w = pdf_get_value($pdf, "imagewidth", $image);
$h = pdf_get_value($pdf, "imageheight", $image);
pdf_begin_page($pdf, $w * 2, $h * 2);
pdf_place_image($pdf, $image, $w / 2, $h / 2, 1);
pdf_end_page($pdf);
pdf_close($pdf);
$mybuf = PDF_get_buffer($pdf);
$mylen = strlen($mybuf);
header("Content-type: application/pdf");
header("Content-Length: {$mylen}");
header("Content-Disposition: inline; filename=chart.pdf");
print $mybuf;
PDF_delete($pdf);
unlink($fname);
}
示例4: PDF_show_xy
PDF_show_xy($pdf, $line, 20, $y - 300);
PDF_show_xy($pdf, $total, 250, $y - 320);
PDF_show_xy($pdf, $doubleline, 250, $y - 330);
PDF_show_xy($pdf, $descript, 30, $y - 400);
//PRINT AMOUNT ----------------------------------------------------------
$amt_x = 470;
$amt_y = 655;
PDF_show_xy($pdf, '$ ' . $debit_card, $amt_x, $amt_y - 30);
PDF_show_xy($pdf, '$ ' . $amex_card, $amt_x, $amt_y - 60);
PDF_show_xy($pdf, '$ ' . $visa_card, $amt_x, $amt_y - 90);
PDF_show_xy($pdf, '$ ' . $total_staff_salary, $amt_x, $amt_y - 120);
PDF_show_xy($pdf, '$ ' . $phone_bill, $amt_x, $amt_y - 150);
PDF_show_xy($pdf, '$ ' . $rent_bill, $amt_x, $amt_y - 180);
PDF_show_xy($pdf, '$ ' . $electricity_bill, $amt_x, $amt_y - 210);
PDF_show_xy($pdf, '$ ' . $director_fee, $amt_x, $amt_y - 240);
PDF_show_xy($pdf, '$ ' . $consignment_payment, $amt_x, $amt_y - 270);
PDF_show_xy($pdf, '$ ' . $total_amount, $amt_x, $amt_y - 320);
PDF_show_xy($pdf, strtoupper($desc), 150, $amt_y - 400);
PDF_close_image($pdf, $images);
//test
/*end page*/
PDF_end_page($pdf);
/*close and save file*/
PDF_close($pdf);
$buf = PDF_get_buffer($pdf);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: {$len}");
header("Content-Disposition: inline; filename=gen01.pdf");
print $buf;
PDF_save($pdf);
示例5: run
//.........这里部分代码省略.........
}
/* Make an instance of the table class */
switch ($this->orientation) {
case LANDSCAPE:
$this->table = new jh_pdf_table(&$this->pdf, &$this->ypos, $this->subx, 812, 30);
break;
case PORTRAIT:
$this->table = new jh_pdf_table(&$this->pdf, &$this->ypos, $this->subx, 565, 30);
break;
}
/* Set a function that will be called if a new page is necessary */
$this->table->setnewpagefunction(newpage);
if ($this->issubreport) {
$this->table->setverttableborderwidth(1);
$this->table->setverttablebordercolor(0);
//$this->table->setcolspacingwidth(1);
//$this->table->setcolspacingcolor(0);
$this->table->setrowspacingwidth(1);
$this->table->setrowspacingcolor(0);
}
$this->table->setheaderbgcolor($this->headercolor);
$this->table->setbgcolors(array(false, 0.9));
}
if ($this->outputformat == HTML) {
echo "<link rel=\"StyleSheet\" href=\"phpreport/report.css\" type=\"text/css\" />\n";
echo "<style type=\"text/css\">";
echo "@import url(\"phpreport/report.css\"); ";
echo "</style>";
}
$w = "width=\"100%\"";
if ($this->issubreport) {
$w = "width=\"100%\"";
}
$b = "1";
if ($this->issubreport) {
$b = "0";
}
if ($this->outputformat == HTML) {
if ($this->title != '') {
$fecha = date("d/m/Y h:m:s");
echo "<table {$w} border=\"0\"><tr><td><h2>{$this->title}</h2></td><td align=\"right\">{$fecha}</td></tr></table>";
}
echo "<table {$w} border=\"{$b}\" cellspacing=\"0\" cellpadding=\"2\">";
}
while (list($bandname, $bandparams) = each($this->bands)) {
$this->renderBand($bandparams);
}
if ($this->outputformat == HTML) {
if ($this->showsummaries) {
$cs = count($this->phpgrid->printable);
echo "<tr class=\"reportdetaileven\">";
echo "<td colspan=\"{$cs}\" align=\"right\">{$this->recordcount} registro(s)</td>";
echo "</tr>";
}
echo "</table>";
}
if ($this->outputformat == PDF) {
/* Close the table (important!) */
$this->table->endtable();
}
if ($this->showsummaries) {
if ($this->outputformat == PDF) {
$rm = 0;
// Make an instance of the table class
switch ($this->orientation) {
case LANDSCAPE:
$rm = 812;
break;
case PORTRAIT:
$rm = 565;
break;
}
$this->ypos -= 10;
// Make an instance of the class
$text = new jh_pdf_flowingtext(&$this->pdf, &$this->ypos, 30, $rm, 30);
$text->setfontsize(9);
$text->addtext($this->recordcount . " registro(s)", true);
$text->puttext(30, $this->ypos, "right", 0);
$this->ypos -= 26;
}
}
if ($this->outputformat == PDF) {
if (!$this->issubreport) {
/* Close the last page */
PDF_end_page($this->pdf);
/* Close the PDF document */
PDF_close($this->pdf);
/* Output the current part of the in-memory created PDF document */
print PDF_get_buffer($this->pdf);
/* Delete the PDFlib object */
PDF_delete($this->pdf);
}
}
} else {
$sbsearch_x = 1;
$this->phpgrid->showformatcombo = TRUE;
$this->phpgrid->showgrid = 0;
$this->phpgrid->run();
}
}
示例6: pdf_set_info
pdf_set_info($pdfFile, "Creator", "Ahmed Elbshry");
pdf_set_info($pdfFile, "Title", "PDFlib");
pdf_set_info($pdfFile, "Subject", "Using PDFlib");
//starting our page and define the width and highet of the document
pdf_begin_page($pdfFile, 595, 842);
//check if Arial font is found, or exit
if ($font = PDF_findfont($pdfFile, "Arial", "winansi", 1)) {
PDF_setfont($pdfFile, $font, 12);
} else {
echo "Font Not Found!";
PDF_end_page($pdfFile);
PDF_close($pdfFile);
PDF_delete($pdfFile);
exit;
}
//start writing from the point 50,780
PDF_show_xy($pdfFile, "This Text In Arial Font", 50, 780);
PDF_end_page($pdfFile);
PDF_close($pdfFile);
//store the pdf document in $pdf
$pdf = PDF_get_buffer($pdfFile);
//get the len to tell the browser about it
$pdflen = strlen($pdfFile);
//telling the browser about the pdf document
header("Content-type: application/pdf");
header("Content-length: {$pdflen}");
header("Content-Disposition: inline; filename=phpMade.pdf");
//output the document
print $pdf;
//delete the object
PDF_delete($pdfFile);
示例7: jh_pdf_barcode_jhpci
$barcode = new jh_pdf_barcode_jhpci(&$pdf);
$barcode->settype('25i');
/* Create a text object which will contain the barcode data as plain text */
$text = new jh_pdf_text_jhpci(&$pdf);
$text->setalignment("center");
/* Create a container object and put the barcode and text objects into it
with some empty space between them */
$container = new jh_pdf_container(&$pdf);
$container->addobject($barcode);
$container->addemptyspace(5);
$container->addobject($text);
$container->setwidth(100);
/* Define some test codes */
$code1 = "1231231230";
$code2 = "4564564560";
$code3 = "7897897890";
/* Set the barcode text and put it onto the PDF document */
$container->setdata($code1);
$container->putcontainer(30, 812, 100);
$container->setdata($code2);
$container->putcontainer(230, 812, 100);
$container->setdata($code3);
$container->putcontainer(430, 812, 100);
/* Close the last page */
PDF_end_page($pdf);
/* Close the PDF document */
PDF_close($pdf);
/* Output the in-memory created PDF document */
print PDF_get_buffer($pdf);
/* Delete the PDFlib object */
PDF_delete($pdf);
示例8: PDF_show_xy
PDF_show_xy($mypdf, "Online Bus Ticket", 200, 800);
PDF_show_xy($mypdf, "Your Ticket Details", 70, 700);
PDF_continue_text($mypdf, "Bus Details");
PDF_continue_text($mypdf, "Bus ID: " . $b[0] . " Bus Name:" . $b[1] . " From: " . $b[2] . " To: " . $b[3]);
PDF_continue_text($mypdf, "Departure: " . $b[4] . " Arrival:" . $b[5] . " Type: " . $b[6] . "Seats:" . $b[7]);
PDF_continue_text($mypdf, " Fare: " . $b[8] . " Facilities: " . $b[9] . " Stars: " . $b[10]);
PDF_continue_text($mypdf, "===================================================================");
PDF_continue_text($mypdf, "Your Details");
PDF_continue_text($mypdf, "Your Name: " . $u[0] . " Email: " . $u[1] . " Mobile: " . $u[2] . " Address: " . $u[3]);
PDF_continue_text($mypdf, "Country: " . $u[4] . " Gender: " . $u[5] . " BusID: " . $u[6] . " Bus Date: " . $u[7]);
PDF_continue_text($mypdf, "Registration Date: " . $u[8] . " Your Seats: " . $u[9] . " Seats: " . $u[10]);
PDF_continue_text($mypdf, "Price: " . $u[11] . " PNR: " . $u[12]);
PDF_continue_text($mypdf, "===================================================================");
PDF_continue_text($mypdf, "IMPORTANT INFORMATION");
PDF_continue_text($mypdf, "No. of Seats: " . $u[9]);
PDF_continue_text($mypdf, " Seats: " . $u[10]);
PDF_continue_text($mypdf, "PNR: " . $u[12]);
PDF_continue_text($mypdf, "===================================================================");
PDF_continue_text($mypdf, "Contact us : 9957809805");
PDF_continue_text($mypdf, "Terms and Conditions Apply");
PDF_continue_text($mypdf, "Visit www.01fes.com");
PDF_show_xy($mypdf, "HAPPY JOURNEY", 200, 400);
PDF_end_page($mypdf);
PDF_close($mypdf);
$mybuf = PDF_get_buffer($mypdf);
$mylen = strlen($mybuf);
header("Content-type: application/pdf");
header("Content-Length: {$mylen}");
header("Content-Disposition: inline; filename=busticket4.pdf");
print $mybuf;
PDF_delete($mypdf);
示例9: display
function display()
{
if (isset($this->pdf)) {
// ページを閉じる
$this->closePage();
// PDFの終了
PDF_end_document($this->pdf, NULL);
// 出力用データの取得
$buf = PDF_get_buffer($this->pdf);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: {$len}");
header("Content-Disposition: inline; filename=" . date("YmdHis") . ".pdf");
/*
* session_start()を事前に呼び出している場合に出力される以下のヘッダは、
* URL直接呼び出し時にエラーを発生させるので空にしておく。
*
* Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
* Progma: no-cache
*
*/
header("Cache-Control: ");
header("Pragma: ");
print $buf;
// PDF解放
PDF_delete($this->pdf);
} else {
print "PDFが生成されていません。";
}
exit;
}
示例10: carl_merge_pdfs_pdflib
//.........这里部分代码省略.........
if ($pdfver > $maxpdfver) {
$maxpdfver = $pdfver;
}
/* Close the input document.
* Depending on the number of PDFs and memory strategy, PDI handles
* to all documents could also be kept open between the first and
* second run (requires more memory, but runs faster). We close all
* PDFs after checking the version number, and reopen them in the
* second loop (requires less memory, but is slower).
*/
if (function_exists('PDF_close_pdi_document')) {
PDF_close_pdi_document($p, $indoc);
} else {
PDF_close_pdi($p, $indoc);
}
// pre-pecl 2.1
}
/* ---------------------------------------------------------------
* Open the output document with the maximum PDF version retrieved
* ---------------------------------------------------------------
*/
if ($maxpdfver > '1.0') {
$optlist = 'compatibility=' . $maxpdfver;
} else {
$optlist = '';
}
if (PDF_begin_document($p, '', $optlist) == -1) {
trigger_error('Error: ' . PDF_get_errmsg($p));
}
foreach ($metadata as $key => $value) {
PDF_set_info($p, $key, $value);
}
//PDF_set_info($p, 'Creator', 'Test Creator');
//PDF_set_info($p, 'Title', $title . ' $Revision: 1.1 $');
//echo '4 ';
/* --------------------------------------------------------------------
* Loop over all input documents to merge them into the output document * used
* --------------------------------------------------------------------
*/
foreach ($pdffiles as $pdffile) {
$endpage = $pageno = $page = 0;
/* Open the input PDF */
if (function_exists('PDF_open_pdi_document')) {
$indoc = PDF_open_pdi_document($p, $pdffile, '');
} else {
$indoc = PDF_open_pdi($p, $pdffile, '', 0);
}
// pre-pecl 2.1
if ($indoc < 1) {
trigger_error('Error: ' . PDF_get_errmsg($p));
continue;
}
if (function_exists('PDF_pcos_get_number')) {
$endpage = (int) PDF_pcos_get_number($p, $indoc, '/Root/Pages/Count');
} else {
$endpage = (int) PDF_get_pdi_value($p, '/Root/Pages/Count', $indoc, 0, 0);
}
// pre-pecl 2.1
/* Loop over all pages of the input document */
for ($pageno = 1; $pageno <= $endpage; $pageno++) {
$page = PDF_open_pdi_page($p, $indoc, $pageno, '');
if ($page == 0) {
trigger_error('Error: ' . PDF_get_errmsg($p));
continue;
}
/* Dummy page size; will be adjusted later */
PDF_begin_page_ext($p, 10, 10, '');
/* Create a bookmark with the file name */
if ($pageno == 1) {
if (isset($titles[$pdffile])) {
$bookmark = pack('H*', 'feff') . mb_convert_encoding($titles[$pdffile], 'UTF-16', $metadata_encoding);
} else {
$bookmark = pack('H*', 'feff') . mb_convert_encoding($pdffile, 'UTF-16', $metadata_encoding);
}
/* if(isset($titles[$pdffile]))
$bookmark = $titles[$pdffile];
else
$bookmark = $pdffile; */
PDF_create_bookmark($p, $bookmark, '');
}
/* Place the imported page on the output page, and
* adjust the page size
*/
PDF_fit_pdi_page($p, $page, 0, 0, 'adjustpage');
PDF_close_pdi_page($p, $page);
PDF_end_page_ext($p, '');
}
/* Close the input document */
if (function_exists('PDF_close_pdi_document')) {
PDF_close_pdi_document($p, $indoc);
} else {
PDF_close_pdi($p, $indoc);
}
// pre-pecl 2.1
}
PDF_end_document($p, '');
$buffer = PDF_get_buffer($p);
pdf_delete($p);
return $buffer;
}