コード例 #1
0
 function close()
 {
     $this->_show_watermark();
     pdf_end_page($this->pdf);
     pdf_close($this->pdf);
     pdf_delete($this->pdf);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 function close()
 {
     pdf_end_page($this->pdf);
     pdf_close($this->pdf);
     pdf_delete($this->pdf);
 }
コード例 #4
0
ファイル: PDF.php プロジェクト: ballistiq/revive-adserver
 /**
  * Output the result of the canvas
  *
  * @param array $param Parameter array
  * @abstract
  */
 function save($param = false)
 {
     parent::save($param);
     pdf_end_page($this->_pdf);
     pdf_close($this->_pdf);
     $buf = pdf_get_buffer($this->_pdf);
     $len = strlen($buf);
     $fp = @fopen($param['filename'], 'wb');
     if ($fp) {
         fwrite($fp, $buf, strlen($buf));
         fclose($fp);
     }
     pdf_delete($this->_pdf);
 }
コード例 #5
0
ファイル: clock.php プロジェクト: dw4dev/Phalanger
/* draw second hand */
pdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
pdf_setlinewidth($pdf, 2);
pdf_save($pdf);
pdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
pdf_moveto($pdf, -$radius / 5, 0.0);
pdf_lineto($pdf, $radius, 0.0);
pdf_stroke($pdf);
pdf_restore($pdf);
/* draw little circle at center */
pdf_circle($pdf, 0, 0, $radius / 30);
pdf_fill($pdf);
pdf_restore($pdf);
/* DONE */
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
// hides "Generating ..." message:
echo "<script language='JavaScript'>document.getElementById('loading').style.display = 'none';</script>";
if (!file_exists($file)) {
    ?>
    <h2 style="color: red">Error occured: file <?php 
    echo $file;
    ?>
 does not exist!</h2>
<?php 
}
?>
    It is exactly <?php 
echo $stime;
?>
コード例 #6
0
ファイル: display.php プロジェクト: rickogden/web-pres2
 function _presentation(&$presentation)
 {
     global $pres;
     $_SESSION['selected_display_mode'] = get_class($this);
     // In PDF mode we loop through all the slides and make a single
     // big multi-page PDF document.
     $this->page_number = 0;
     $this->pdf = pdf_new();
     if (!empty($pdfResourceFile)) {
         pdf_set_parameter($this->pdf, "resourcefile", $pdfResourceFile);
     }
     pdf_open_file($this->pdf, null);
     pdf_set_info($this->pdf, "Author", isset($presentation->speaker) ? $presentation->speaker : "Anonymous");
     pdf_set_info($this->pdf, "Title", isset($presentation->title) ? $presentation->title : "No Title");
     pdf_set_info($this->pdf, "Creator", "See Author");
     pdf_set_info($this->pdf, "Subject", isset($presentation->topic) ? $presentation->topic : "");
     while (list($this->slideNum, $slide) = each($presentation->slides)) {
         // testing hack
         $slideDir = dirname($this->presentationDir . '/' . $presentation->slides[$this->slideNum]->filename) . '/';
         $fn = $this->presentationDir . '/' . $presentation->slides[$this->slideNum]->filename;
         $fh = fopen($fn, "rb");
         $r =& new XML_Slide($fh);
         $r->setErrorHandling(PEAR_ERROR_DIE, "%s ({$fn})\n");
         $r->parse();
         $this->objs = $r->getObjects();
         $this->my_new_pdf_page($this->pdf, $this->pdf_x, $this->pdf_y, true);
         $this->pdf_cx = $this->pdf_cy = 0;
         // Globals that keep our current x,y position
         while (list($this->coid, $obj) = each($this->objs)) {
             $obj->display();
         }
         $this->my_new_pdf_end_page($this->pdf);
     }
     $this->my_new_pdf_page($this->pdf, $this->pdf_x, $this->pdf_y, true);
     pdf_set_font($this->pdf, $this->pdf_font, -20, 'winansi');
     $fnt = pdf_findfont($this->pdf, $this->pdf_font, 'winansi', 0);
     $dx = pdf_stringwidth($this->pdf, "Index", $fnt, -20);
     $x = (int) ($this->pdf_x / 2 - $dx / 2);
     pdf_set_parameter($this->pdf, "underline", 'true');
     pdf_show_xy($this->pdf, "Index", $x, 60);
     pdf_set_parameter($this->pdf, "underline", 'false');
     $this->pdf_cy = pdf_get_value($this->pdf, "texty", null) + 30;
     $old_cy = $this->pdf_cy;
     pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi');
     if (is_array($this->page_index)) {
         foreach ($this->page_index as $pn => $ti) {
             if ($ti == 'titlepage') {
                 continue;
             }
             $ti .= '    ';
             while (pdf_stringwidth($this->pdf, $ti, $fnt, -12) < $this->pdf_x - $this->pdf_cx * 2.5 - 140) {
                 $ti .= '.';
             }
             pdf_show_xy($this->pdf, $ti, $this->pdf_cx * 2.5, $this->pdf_cy);
             $dx = pdf_stringwidth($this->pdf, $pn, $fnt, -12);
             pdf_show_xy($this->pdf, $pn, $this->pdf_x - 2.5 * $this->pdf_cx - $dx, $this->pdf_cy);
             $this->pdf_cy += 15;
             if ($this->pdf_cy > $this->pdf_y - 50) {
                 $this->my_new_pdf_end_page($this->pdf);
                 $this->my_new_pdf_page($this->pdf, $this->pdf_x, $this->pdf_y, false);
                 $this->pdf_cy = $old_cy;
                 pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi');
             }
         }
     }
     $this->my_new_pdf_end_page($this->pdf);
     pdf_close($this->pdf);
     $data = pdf_get_buffer($this->pdf);
     header('Content-type: application/pdf');
     header('Content-disposition: inline; filename=' . $_SESSION['currentPres'] . '.pdf');
     header("Content-length: " . strlen($data));
     echo $data;
 }
コード例 #7
0
ファイル: pdflib.php プロジェクト: linuxwhy/tiki-1
 function writeToStream($stream)
 {
     pdf_end_page($this->pdf);
     pdf_close($this->pdf);
     $buf = pdf_get_buffer($this->pdf);
     fwrite($stream, $buf);
     pdf_delete($this->pdf);
 }
コード例 #8
0
 function finish()
 {
     pdf_close($this->pdf);
     pdf_delete($this->pdf);
 }