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);
 }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 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;
 }
 function next_page()
 {
     $this->_show_watermark();
     $this->current_page++;
     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 -= $this->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);
 }
Пример #5
0
pdf_restore($pdf);
/* 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
 function my_new_pdf_end_page(&$pdf)
 {
     pdf_end_page($pdf);
 }
Пример #7
0
 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 end_page()
 {
     pdf_end_page($this->pdf);
 }