当前位置: 首页>>代码示例>>PHP>>正文


PHP pdf_begin_page函数代码示例

本文整理汇总了PHP中pdf_begin_page函数的典型用法代码示例。如果您正苦于以下问题:PHP pdf_begin_page函数的具体用法?PHP pdf_begin_page怎么用?PHP pdf_begin_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pdf_begin_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PDFLib_GRenderer

 function PDFLib_GRenderer($format = null, $orientation = 'landscape')
 {
     // Null size does not create a graphic.
     $this->styles = array();
     $this->font = null;
     if (!is_null($format)) {
         $size = $this->_getFormat($format, $orientation);
         $this->width = $size[0];
         $this->height = $size[1];
         $this->pdf = pdf_new();
         pdf_open_file($this->pdf, '');
         pdf_begin_page($this->pdf, $this->width, $this->height);
         $this->font = pdf_findfont($this->pdf, 'Helvetica', 'builtin', 0);
     }
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:15,代码来源:pdflib.php

示例2: begin_page

 function begin_page($title)
 {
     pdf_begin_page($this->pdf, $this->pw, $this->ph);
     pdf_setlinewidth($this->pdf, 1);
     $ttl = $title;
     if ($this->pg_num) {
         $this->pg_num++;
         $ttl .= ' #' . $this->pg_num;
     } else {
         $this->pg_num = 1;
     }
     pdf_add_bookmark($this->pdf, $ttl);
     pdf_setfont($this->pdf, $this->fonts['Courier'], 12);
     pdf_set_text_pos($this->pdf, $this->wmargin, $this->ph - $this->hmargin);
     $this->pg_title = $title;
 }
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:16,代码来源:pdf.php

示例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);
 }
开发者ID:BoulderOWASP,项目名称:SnowFROC_CTF_2013_Exercises,代码行数:20,代码来源:phpchart.class.php

示例4: next_page

 function next_page($height)
 {
     if ($this->_status == PDFLIB_STATUS_PAGE_STARTED) {
         pdf_end_page($this->pdf);
     }
     pdf_begin_page($this->pdf, mm2pt($this->media->width()), mm2pt($this->media->height()));
     // Calculate coordinate of the next page bottom edge
     $this->offset -= $height - $this->offset_delta;
     // Reset the "correction" offset to it normal value
     // Note: "correction" offset is an offset value required to avoid page breaking
     // in the middle of text boxes
     $this->offset_delta = 0;
     pdf_translate($this->pdf, 0, -$this->offset);
     parent::next_page($height);
     $this->_status = PDFLIB_STATUS_PAGE_STARTED;
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:16,代码来源:output.pdflib.class.php

示例5: Image_Canvas_PDF


//.........这里部分代码省略.........
             case '11X17':
                 $this->_pageWidth = 792;
                 $this->_pageHeight = 1224;
                 break;
             case 'CD_FRONT':
                 $this->_pageWidth = 337;
                 $this->_pageHeight = 337;
                 break;
             case 'INLAY':
                 $this->_pageWidth = 425;
                 $this->_pageHeight = 332;
                 break;
             case 'INLAY_NOSIDES':
                 $this->_pageWidth = 390;
                 $this->_pageHeight = 332;
                 break;
         }
     }
     if (isset($param['orientation']) && strtoupper($param['orientation']) == 'LANDSCAPE') {
         $w = $this->_pageWidth;
         $this->_pageWidth = $this->_pageHeight;
         $this->_pageHeight = $w;
     }
     parent::Image_Canvas($param);
     if (!$this->_pageWidth) {
         $this->_pageWidth = $this->_width;
     } elseif (!$this->_width) {
         $this->_width = $this->_pageWidth;
     }
     if (!$this->_pageHeight) {
         $this->_pageHeight = $this->_height;
     } elseif (!$this->_height) {
         $this->_height = $this->_pageHeight;
     }
     $this->_width = min($this->_width, $this->_pageWidth);
     $this->_height = min($this->_height, $this->_pageHeight);
     if (isset($param['align']) && ($this->_width != $this->_pageWidth || $this->_height != $this->_pageHeight)) {
         switch (strtoupper($param['align'])) {
             case 'TOPLEFT':
                 $this->_top = 0;
                 $this->_left = 0;
                 break;
             case 'TOPCENTER':
                 $this->_top = 0;
                 $this->_left = ($this->_pageWidth - $this->_width) / 2;
                 break;
             case 'TOPRIGHT':
                 $this->_top = 0;
                 $this->_left = $this->_pageWidth - $this->_width;
                 break;
             case 'LEFTCENTER':
                 $this->_top = ($this->_pageHeight - $this->_height) / 2;
                 $this->_left = 0;
                 break;
             case 'CENTER':
                 $this->_top = ($this->_pageHeight - $this->_height) / 2;
                 $this->_left = ($this->_pageWidth - $this->_width) / 2;
                 break;
             case 'RIGHTCENTER':
                 $this->_top = ($this->_pageHeight - $this->_height) / 2;
                 $this->_left = $this->_pageWidth - $this->_width;
                 break;
             case 'LEFTBOTTOM':
                 $this->_top = $this->_pageHeight - $this->_height;
                 $this->_left = 0;
                 break;
             case 'CENTERBOTTOM':
                 $this->_top = $this->_pageHeight - $this->_height;
                 $this->_left = ($this->_pageWidth - $this->_width) / 2;
                 break;
             case 'RIGHTBOTTOM':
                 $this->_top = $this->_pageHeight - $this->_height;
                 $this->_left = $this->_pageWidth - $this->_width;
                 break;
         }
     }
     $this->_pdflib = $this->_version();
     $addPage = true;
     if (isset($param['pdf']) && is_resource($param['pdf'])) {
         $this->_pdf =& $param['pdf'];
         if (isset($param['add_page']) && $param['add_page'] === false) {
             $addPage = false;
         }
     } else {
         $this->_pdf = pdf_new();
         if (isset($param['filename'])) {
             pdf_open_file($this->_pdf, $param['filename']);
         } else {
             pdf_open_file($this->_pdf, '');
         }
         pdf_set_parameter($this->_pdf, 'warning', 'true');
         pdf_set_info($this->_pdf, 'Creator', isset($param['creator']) ? $param['creator'] : 'PEAR::Image_Canvas');
         pdf_set_info($this->_pdf, 'Author', isset($param['author']) ? $param['author'] : 'Jesper Veggerby');
         pdf_set_info($this->_pdf, 'Title', isset($param['title']) ? $param['title'] : 'Image_Canvas');
     }
     if ($addPage) {
         pdf_begin_page($this->_pdf, $this->_pageWidth, $this->_pageHeight);
     }
     $this->_reset();
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:PDF.php

示例6: reset

 function reset(&$media)
 {
     OutputDriverGenericPDF::reset($media);
     // Check if PDFLIB is available
     if (!extension_loaded('pdf')) {
         // Try to use "dl" to dynamically load PDFLIB
         $result = dl(PDFLIB_DL_PATH);
         if (!$result) {
             readfile(HTML2PS_DIR . '/templates/missing_pdflib.html');
             error_log("No PDFLIB extension found");
             die;
         }
     }
     $this->pdf = pdf_new();
     // Set PDF compatibility level
     pdf_set_parameter($this->pdf, "compatibility", $this->get_pdf_version());
     /**
      * Use PDF license key, if present
      *
      * PDFLIB_LICENSE constant is defined in 'config.inc.php' file in "PDFLIB-specific" section.
      */
     if (defined("PDFLIB_LICENSE")) {
         pdf_set_parameter($this->pdf, "license", PDFLIB_LICENSE);
     }
     pdf_open_file($this->pdf, $this->get_filename());
     // @TODO: compression level, debug
     pdf_set_value($this->pdf, "compress", 0);
     // Set path to the PDFLIB UPR file containig information about fonts and encodings
     if (defined("PDFLIB_UPR_PATH")) {
         pdf_set_parameter($this->pdf, "resourcefile", PDFLIB_UPR_PATH);
     }
     // Setup font outlines
     global $g_font_resolver_pdf;
     $g_font_resolver_pdf->setup_ttf_mappings($this->pdf);
     $pdf = $this->pdf;
     pdf_set_info($pdf, "Creator", "html2ps (PHP version)");
     // No borders around links in the generated PDF
     pdf_set_border_style($this->pdf, "solid", 0);
     pdf_begin_page($this->pdf, mm2pt($this->media->width()), mm2pt($this->media->height()));
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:40,代码来源:output.pdflib.class.php

示例7: new_pdf

<?php

//getting new instance
$pdfFile = new_pdf();
PDF_open_file($pdfFile, " ");
//document info
pdf_set_info($pdfFile, "Auther", "Ahmed Elbshry");
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
开发者ID:nchopra,项目名称:C4G-BLIS,代码行数:31,代码来源:export_pdf.php

示例8: tempnam

$ring = 40;
$header = 20;
$footer = 228;
$file = tempnam("", "tests") . '.pdf';
$width = 2 * ($radius + $margin);
$height = 2 * ($radius + $margin) + $header + $footer;
$pdf = pdf_new();
if (!pdf_open_file($pdf, $file)) {
    echo "error";
    exit;
}
pdf_set_parameter($pdf, "warning", "true");
pdf_set_info($pdf, "Creator", "Phalanger");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Analog Clock");
pdf_begin_page($pdf, $width, $height);
function center($s, $y, $size, $fontname = "Times-Roman", $outline = 0)
{
    global $pdf, $font, $width;
    pdf_set_value($pdf, "textrendering", $outline);
    $font = pdf_findfont($pdf, $fontname, "iso8859-2");
    pdf_setfont($pdf, $font, $size);
    $w = pdf_stringwidth($pdf, $s);
    pdf_show_xy($pdf, $s, ($width - $w) / 2, $y);
}
/* outlined */
center("It is {$texttime}.", $height - 60, 42, "Times-Roman", 1);
center("It is time for", 200, 100, "Times-Roman", 1);
/* filled */
center("Phalanger!", 70, 110, "Times-Bold", 0);
pdf_translate($pdf, $radius + $margin, $radius + $margin + $footer);
开发者ID:dw4dev,项目名称:Phalanger,代码行数:31,代码来源:clock.php

示例9: fopen

<?php

//create file
$fp = fopen('hello.pdf', 'w');
if (!$fp) {
    echo "Error: could not create the PDF file";
    exit;
}
// start the pdf document
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Creator", "pdftest.php");
pdf_set_info($pdf, "Author", "Luke Welling and Laura Thomson");
pdf_set_info($pdf, "Title", "Hello World (PHP)");
// US letter is 11" x 8.5" and there are 72 points per inch
pdf_begin_page($pdf, 8.5 * 72, 11 * 72);
pdf_add_outline($pdf, 'Page 1');
$font = pdf_findfont($pdf, 'Times-Roman', 'host', 0);
pdf_setfont($pdf, $font, 24);
pdf_set_text_pos($pdf, 50, 700);
// write text
pdf_show($pdf, 'Hello,world!');
pdf_continue_text($pdf, '(says PHP)');
// end the document
pdf_end_page($pdf);
pdf_close($pdf);
fclose($fp);
// display a link to download
echo "download the pdf <a href = 'hello.pdf'>here</a>";
?>
    
开发者ID:kmfb21,项目名称:A290CGI-PHP,代码行数:29,代码来源:testpdf.php

示例10: my_new_pdf_page

 function my_new_pdf_page(&$pdf, $x, $y, $new_page = true)
 {
     if ($new_page) {
         $this->page_number++;
     }
     pdf_begin_page($pdf, $x, $y);
     // Having the origin in the bottom left corner confuses the
     // heck out of me, so let's move it to the top-left.
     pdf_translate($pdf, 0, $y);
     pdf_scale($pdf, 1, -1);
     // Reflect across horizontal axis
     pdf_set_value($pdf, "horizscaling", -100);
     // Mirror
 }
开发者ID:rickogden,项目名称:web-pres2,代码行数:14,代码来源:display.php

示例11: pdf_load_font

$font = pdf_load_font($pdf, 'Helvetica', 'host', '');
// winansi, host, iso8859-1, unicode >> unicode and glyph id addressing not supported in PDFlib Lite!!!
if (NJB_DEFAULT_CHARSET == 'UTF-8') {
    pdf_set_parameter($pdf, 'textformat', 'utf8');
}
pdf_set_info($pdf, 'Creator', 'netjukebox ' . NJB_VERSION);
pdf_set_info($pdf, 'Title', $album['artist'] . ' - ' . $album['album']);
$width = 210;
// A4
$height = 297;
// A4
$scale = 72 / 25.4;
// mm to dtp-point (1 point = 1/72 inch; 1 inch = 25.4 mm)
$hash_data = pdf_get_value($pdf, 'major', 0) . '-' . pdf_get_value($pdf, 'minor', 0) . '-' . NJB_VERSION;
$hash_data .= '-' . $album['artist'] . ' - ' . $album['album'] . '-' . $width . '-' . $height;
pdf_begin_page($pdf, $width * $scale, $height * $scale);
pdf_scale($pdf, $scale, $scale);
pdf_setlinewidth($pdf, 0.1);
//  +------------------------------------------------------------------------+
//  | PDF back cover                                                         |
//  +------------------------------------------------------------------------+
$x0 = 30;
$y0 = 22;
pdf_translate($pdf, $x0, $y0);
pdf_moveto($pdf, 0, -1);
pdf_lineto($pdf, 0, -11);
pdf_moveto($pdf, 6.5, -1);
pdf_lineto($pdf, 6.5, -11);
pdf_moveto($pdf, 144.5, -1);
pdf_lineto($pdf, 144.5, -11);
pdf_moveto($pdf, 151, -1);
开发者ID:jdeblese,项目名称:ompd-mod,代码行数:31,代码来源:cover.php

示例12: pdf_new

<?php

// create handle for new PDF document
$pdf = pdf_new();
// open a file
pdf_open_file($pdf, "philosophy.pdf");
// start a new page (A4)
pdf_begin_page($pdf, 595, 842);
// get and use a font object
$arial = pdf_findfont($pdf, "Arial", "host", 1);
pdf_setfont($pdf, $arial, 10);
// print text
pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750);
pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730);
// end page
pdf_end_page($pdf);
// close and save file
pdf_close($pdf);
开发者ID:aedvalson,项目名称:Nexus,代码行数:18,代码来源:pdflibtest.php

示例13: pdf_new

    echo 'previamente generada por este programa';
    exit;
}
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_set_info($pdf, "Author", "Jes&#250;s M. Castagnetto");
pdf_set_info($pdf, "Title", "Ejemplo de Factura");
pdf_set_info($pdf, "Creator", "Jes&#250;s M. Castagnetto");
pdf_set_info($pdf, "Subject", "Ejemplo de Factura");
$sizes = array('a4' => '595x842', 'letter' => '612x792', 'legal' => '612x1008');
if (!isset($type)) {
    $type = 'a4';
}
list($x, $y) = explode('x', $sizes[$type]);
$items = array(array('Un programa simple que hace de todo', '299.99'), array('El programa especial sin el que el anterior no corre', '1899'), array('Una libreria de comunicacion', '29.95'), array('Un programa para bloquear la comunicacion', '49.95'), array('Una libreria que comprime todo a 1 byte', '49.9'), array('Y un programa que permite recuperar lo comprimido a 1 byte', '39999.95'));
pdf_begin_page($pdf, $x, $y);
$imagepath = realpath('../images/booger.jpg');
$im = pdf_open_jpeg($pdf, $imagepath);
pdf_place_image($pdf, $im, 5, $y - 72, 0.5);
pdf_close_image($pdf, $im);
pdf_set_value($pdf, 'textrendering', 0);
// fill
pdf_set_font($pdf, "Helvetica", 12, winansi);
pdf_show_xy($pdf, 'Micro Snot & L4m3r5 S.R.L.', 145, $y - 20);
pdf_continue_text($pdf, '123 Calle del Dolor');
pdf_continue_text($pdf, 'Tacora, Lima 666');
pdf_set_font($pdf, "Helvetica", 10, winansi);
pdf_show_xy($pdf, 'Cliente Sin Salvacion S.A.', 20, $y - 100);
pdf_continue_text($pdf, '1 Calle Pequena');
pdf_continue_text($pdf, 'Cuidad Perdida, Puno 123');
pdf_set_font($pdf, "Helvetica", 10, winansi);
开发者ID:SandyS1,项目名称:presentations,代码行数:31,代码来源:invoice.php

示例14: pdf_new

<?php

# pdf_example4
# a simple bar graph
// create a new pdf document
$pdf = pdf_new();
$filename = 'c:pdf_example4.pdf';
pdf_open_file($pdf, $filename);
// start a new page (Letter size)
pdf_begin_page($pdf, 612, 792);
// setup font and print hello world
pdf_set_parameter($pdf, 'FontOutline', 'Arial=c:windowsfontsarial.ttf');
$font = pdf_findfont($pdf, "Arial", "host", 1);
pdf_setfont($pdf, $font, 16);
pdf_show_xy($pdf, "Simple Bar Graph", 50, 720);
// draw the x and y axis
pdf_moveto($pdf, 50, 690);
pdf_lineto($pdf, 50, 520);
pdf_lineto($pdf, 400, 520);
pdf_stroke($pdf);
// draw the bar chart
$x = 80;
$y = 520;
$w = 40;
// the data and color for each column
$data = array('120', '160', '300', '240');
$color = array('#4EC3BC', '#DAA876', '#E29CC8', '#FDE0C6');
// get into some meat now, cheese for vegetarians;
for ($i = 0; $i < count($data); $i++) {
    // calculate the height of the bar
    $y_ht = $data[$i] / max($data) * 100;
开发者ID:OmondiKevin,项目名称:CD4,代码行数:31,代码来源:interview_Report.php

示例15: define

<?php

define('PAGE_WIDTH', 612);
define('PAGE_HEIGHT', 792);
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_begin_page($pdf, PAGE_WIDTH, PAGE_HEIGHT);
$font = pdf_findfont($pdf, "Helvetica", "auto", false);
pdf_setfont($pdf, $font, 30);
pdf_show_xy($pdf, "PHP Developer's Handbook", 10, PAGE_HEIGHT - 40);
pdf_setfont($pdf, $font, 12);
pdf_show_xy($pdf, "Hello, World! Using PDFLib and PHP", 10, PAGE_HEIGHT - 55);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header("Content-disposition: inline; filename=output.pdf");
header("Content-length: " . strlen($data));
echo $data;
开发者ID:SandyS1,项目名称:presentations,代码行数:19,代码来源:hello.php


注:本文中的pdf_begin_page函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。