15 if (!class_exists(
'FPDI')) {
16 throw new \wcmf\lib\config\ConfigurationException(
17 'wcmf\lib\pdf\PDF requires '.
18 'FPDI. If you are using composer, add setasign/fpdi '.
19 'as dependency to your project');
29 class PDF extends FPDI {
31 private $pageStarted =
false;
32 private $pageEnded =
false;
39 $this->useTemplate($this->tpl);
46 $this->pageStarted =
true;
47 $this->pageEnded =
false;
54 $this->pageEnded =
true;
55 $this->pageStarted =
false;
63 return $this->pageStarted;
71 return $this->pageEnded;
79 $this->SetY($units+$this->GetY());
87 $this->SetX($units+$this->GetX());
98 $lines = preg_split(
'/\n/', $text);
99 foreach ($lines as $line) {
100 $nbLines += $this->
NbLines($width, $line);
116 if($this->GetY()+$h>$this->PageBreakTrigger) {
117 $this->AddPage($this->CurOrientation);
129 $cw=&$this->CurrentFont[
'cw'];
131 $w=$this->w-$this->rMargin-$this->x;
133 $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
134 $s=str_replace(
"\r",
'', $txt);
136 if($nb>0 && $s[$nb-1]==
"\n") {
isPageStarted()
Determine if a new page started.
numberOfLines($width, $text)
Computes the number of lines a MultiCell of width w will take instead of NbLines it correctly handles...
moveRight($units)
Move the render position right by given units.
NbLines($w, $txt)
Computes the number of lines a MultiCell of width w will take.
CheckPageBreak($h)
The following code is taken from FPDF Add-On 'Table with MultiCells'.
PDF related interfaces and classes.
Header()
Overridden to set the template on the page.
endPage()
Call this method when rendering a page finished.
moveDown($units)
Move the render position down by given units.
isPageEnded()
Determine if a page finished.
startPage()
Call this method when rendering a new page.