コード例 #1
0
ファイル: Test.php プロジェクト: rohmad-st/fpdf
 function testCell()
 {
     require_once '../examples/cell/cellpdf.php';
     $pdf = new CellPDF();
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', 12);
     $pdf->VCell(15, 50, "Text at\nbottom", 1, 0, 'D');
     $pdf->VCell(10, 50, 'Centered text', 2, 0, 'C');
     $pdf->VCell(15, 50, "Text\non top", 1, 0, 'U');
     $pdf->Cell(50, 50, "Text on\nthe left", 'lbtR', 0, 'L');
     $pdf->Cell(50, 50, 'This line is very long and gets compressed', 'LtRb', 0, 'C');
     $pdf->Cell(50, 50, "Text on\nthe right", 'Ltrb', 0, 'R');
     $pdf->Output('doc.pdf', 'F');
     $content = file_get_contents('doc.pdf');
     $expected_content = file_get_contents(dirname(__FILE__) . '/../examples/cell/ex.pdf');
     // @todo how can I take the creation date into consideration
     $this->assertEquals($expected_content, $content);
 }
コード例 #2
0
ファイル: ex.php プロジェクト: rohmad-st/fpdf
<?php

require_once '../../src/fpdf.php';
require 'cellpdf.php';
$pdf = new CellPDF();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 12);
$pdf->VCell(15, 50, "Text at\nbottom", 1, 0, 'D');
$pdf->VCell(10, 50, 'Centered text', 2, 0, 'C');
$pdf->VCell(15, 50, "Text\non top", 1, 0, 'U');
$pdf->Cell(50, 50, "Text on\nthe left", 'lbtR', 0, 'L');
$pdf->Cell(50, 50, 'This line is very long and gets compressed', 'LtRb', 0, 'C');
$pdf->Cell(50, 50, "Text on\nthe right", 'Ltrb', 0, 'R');
$pdf->Output();
コード例 #3
0
ファイル: PDF.php プロジェクト: sadr110/webtrees
 /**
  * PDF Setup - WT_Report_PDF
  */
 function setup()
 {
     parent::setup();
     // Setup the PDF class with custom size pages because WT supports more page sizes. If WT sends an unknown size name then the default would be A4
     $this->pdf = new PDF($this->orientation, parent::unit, array($this->pagew, $this->pageh), self::unicode, "UTF-8", self::diskcache);
     // Setup the PDF margins
     $this->pdf->setMargins($this->leftmargin, $this->topmargin, $this->rightmargin);
     $this->pdf->SetHeaderMargin($this->headermargin);
     $this->pdf->SetFooterMargin($this->footermargin);
     //Set auto page breaks
     $this->pdf->SetAutoPageBreak(true, $this->bottommargin);
     // Set font subsetting
     $this->pdf->setFontSubsetting(self::subsetting);
     // Setup PDF compression
     $this->pdf->SetCompression(self::compression);
     // Setup RTL support
     $this->pdf->setRTL($this->rtl);
     // Set the document information
     // Only admin should see the version number
     $appversion = WT_WEBTREES;
     if (Auth::isAdmin()) {
         $appversion .= " " . WT_VERSION;
     }
     $this->pdf->SetCreator($appversion . " (" . parent::wt_url . ")");
     // Not implemented yet - WT_Report_Base::setup()
     $this->pdf->SetAuthor($this->rauthor);
     $this->pdf->SetTitle($this->title);
     $this->pdf->SetSubject($this->rsubject);
     $this->pdf->SetKeywords($this->rkeywords);
     $this->pdf->setReport($this);
     if ($this->showGenText) {
         // The default style name for Generated by.... is 'genby'
         $element = new CellPDF(0, 10, 0, "C", "", "genby", 1, ".", ".", 0, 0, "", "", true);
         $element->addText($this->generatedby);
         $element->setUrl(parent::wt_url);
         $this->pdf->addFooter($element);
     }
 }