CSS extends SVG
in package
Com\Tecnick\Pdf\CSS
CSS PDF class
Tags
Table of Contents
Constants
- BORDERPOS_DEFAULT = 0
- The default relative position of the cell origin when the border is centered on the cell edge.
- BORDERPOS_EXTERNAL = -0.5
- The relative position of the cell origin when the border is external to the cell edge.
- BORDERPOS_INTERNAL = 0.5
- The relative position of the cell origin when the border is internal to the cell edge.
- ZEROCELL = ['margin' => ['T' => 0, 'R' => 0, 'B' => 0, 'L' => 0], 'padding' => ['T' => 0, 'R' => 0, 'B' => 0, 'L' => 0], 'borderpos' => self::BORDERPOS_DEFAULT]
- Default values for cell.
Properties
- $barcode : Barcode
- Barcode object.
- $cache : Cache
- Cache object.
- $color : Pdf
- Color object.
- $encrypt : Encrypt
- Encrypt object.
- $file : File
- File object.
- $font : Stack
- Font object.
- $graph : Draw
- Graph object.
- $image : Import
- Image Import object.
- $page : Page
- Page object.
- $pon : int
- Current PDF object number.
- $uniconv : Convert
- Unicode Convert object.
Methods
- addPage() : PageData
- Add a new page (wrapper function for $this->page->add()).
- addTextCell() : void
- Adds a text block inside a rectangular cell.
- defaultPageContent() : string
- Sets the page common content like Header and Footer.
- enableDefaultPageContent() : void
- Enable or disable the default page content.
- enableZeroWidthBreakPoints() : void
- Enable or disable automatic line breaking points after some non-letter character types.
- getLastBBox() : TBBox
- Returns the last text bounding box [llx, lly, urx, ury].
- getTextCell() : string
- Returns the PDF code to render a text block inside a rectangular cell.
- getTextLine() : string
- Returns the PDF code to render a single line of text.
- loadTexHyphenPatterns() : array<string, string>
- Returns an array of hyphenation patterns.
- setDefaultCellBorderPos() : void
- Sets the default cell border position.
- setDefaultCellMargin() : void
- Set the default cell margin in user units.
- setDefaultCellPadding() : void
- Set the default cell padding in user units.
- setPointToPixelRatio() : void
- Set the pixel/point ratio used to convert pixel values to points.
- setTexHyphenPatterns() : void
- Sets the hyphen patterns for text.
- toPoints() : float
- Convert user units to internal points unit.
- toUnit() : float
- Convert internal points to user unit.
- toYPoints() : float
- Convert vertical user value to internal points unit.
- toYUnit() : float
- Convert vertical internal points value to user unit.
Constants
BORDERPOS_DEFAULT
The default relative position of the cell origin when the border is centered on the cell edge.
public mixed BORDERPOS_DEFAULT =
0
BORDERPOS_EXTERNAL
The relative position of the cell origin when the border is external to the cell edge.
public mixed BORDERPOS_EXTERNAL =
-0.5
BORDERPOS_INTERNAL
The relative position of the cell origin when the border is internal to the cell edge.
public mixed BORDERPOS_INTERNAL =
0.5
ZEROCELL
Default values for cell.
public mixed ZEROCELL = ['margin' => ['T' =>
0, 'R' => 0, 'B' => 0, 'L' => 0], 'padding' => ['T'
=> 0, 'R' => 0, 'B' => 0, 'L' => 0], 'borderpos' =>
self::BORDERPOS_DEFAULT]
Tags
Properties
$barcode
Barcode object.
public Barcode $barcode
$cache
Cache object.
public Cache $cache
$color
Color object.
public Pdf $color
$encrypt
Encrypt object.
public Encrypt
$encrypt
$file
File object.
public File $file
$font
Font object.
public Stack $font
$graph
Graph object.
public Draw $graph
$image
Image Import object.
public Import $image
$page
Page object.
public Page $page
$pon
Current PDF object number.
public int $pon = 0
$uniconv
Unicode Convert object.
public Convert $uniconv
Methods
addPage()
Add a new page (wrapper function for $this->page->add()).
public addPage([PageInputData $data
= []
]) : PageData
Parameters
- $data : PageInputData = []
-
Page data.
Return values
PageData —Page data with additional Page ID property 'pid'.
addTextCell()
Adds a text block inside a rectangular cell.
public addTextCell(string $txt[,
int $pid
= -1
][,
float $posx
= 0
][,
float $posy
= 0
][,
float $width
= 0
][,
float $height
= 0
][,
float $offset
= 0
][,
float $linespace
= 0
][,
string $valign
= 'T'
][,
string $halign
= ''
][,
TCellDef|null $cell
= null
][,
array<int,
StyleDataOpt> $styles
= []
][,
float $strokewidth
= 0
][,
float $wordspacing
= 0
][,
float $leading
= 0
][,
float $rise
= 0
][,
bool $jlast
= true
][,
bool $fill
= true
][,
bool $stroke
= false
][,
bool $underline
= false
][,
bool $linethrough
= false
][,
bool $overline
= false
][,
bool $clip
= false
][,
bool $drawcell
= true
][,
string $forcedir
= ''
][,
TextShadow|null $shadow
= null
]) : void
Accounts for automatic line, page and region breaks.
Parameters
- $txt : string
-
Text string to be processed.
- $pid : int = -1
-
Page index. Omit or set it to -1 for the current page ID.
- $posx : float = 0
-
Abscissa of upper-left corner relative to the region origin X coordinate.
- $posy : float = 0
-
Ordinate of upper-left corner relative to the region origin Y coordinate.
- $width : float = 0
-
Width.
- $height : float = 0
-
Height.
- $offset : float = 0
-
Horizontal offset to apply to the line start.
- $linespace : float = 0
-
Additional space to add between lines.
- $valign : string = 'T'
-
Text vertical alignment inside the cell: T=top; C=center; B=bottom.
- $halign : string = ''
-
Text horizontal alignment inside the cell: L=left; C=center; R=right; J=justify.
- $cell : TCellDef|null = null
-
Optional to overwrite cell parameters for padding, margin etc.
- $styles : array<int, StyleDataOpt> = []
-
Cell border styles (see: getCurrentStyleArray).
- $strokewidth : float = 0
-
Stroke width.
- $wordspacing : float = 0
-
Word spacing (use it only when justify == false).
- $leading : float = 0
-
Leading.
- $rise : float = 0
-
Text rise.
- $jlast : bool = true
-
If true does not justify the last line when $halign == J.
- $fill : bool = true
-
If true fills the text.
- $stroke : bool = false
-
If true stroke the text.
- $underline : bool = false
-
If true underline the text.
- $linethrough : bool = false
-
If true line through the text.
- $overline : bool = false
-
If true overline the text.
- $clip : bool = false
-
If true activate clipping mode.
- $drawcell : bool = true
-
If true draw the cell border.
- $forcedir : string = ''
-
If 'R' forces RTL, if 'L' forces LTR.
- $shadow : TextShadow|null = null
-
Text shadow parameters.
defaultPageContent()
Sets the page common content like Header and Footer.
public defaultPageContent([int $pid
= -1
]) : string
Override this method to add custom content to all pages.
Parameters
- $pid : int = -1
-
Page index. Omit or set it to -1 for the current page ID.
Return values
string —PDF output code.
enableDefaultPageContent()
Enable or disable the default page content.
public enableDefaultPageContent([bool $enable
= true
]) : void
Parameters
- $enable : bool = true
-
Enable or disable the default page content.
enableZeroWidthBreakPoints()
Enable or disable automatic line breaking points after some non-letter character types.
public enableZeroWidthBreakPoints(bool $enabled)
: void
Parameters
- $enabled : bool
getLastBBox()
Returns the last text bounding box [llx, lly, urx, ury].
public getLastBBox()
: TBBox
Return values
TBBox —Array of bounding box values.
getTextCell()
Returns the PDF code to render a text block inside a rectangular cell.
public getTextCell(string $txt[,
float $posx
= 0
][,
float $posy
= 0
][,
float $width
= 0
][,
float $height
= 0
][,
float $offset
= 0
][,
float $linespace
= 0
][,
string $valign
= 'C'
][,
string $halign
= 'C'
][,
TCellDef|null $cell
= null
][,
array<int,
StyleDataOpt> $styles
= []
][,
float $strokewidth
= 0
][,
float $wordspacing
= 0
][,
float $leading
= 0
][,
float $rise
= 0
][,
bool $jlast
= true
][,
bool $fill
= true
][,
bool $stroke
= false
][,
bool $underline
= false
][,
bool $linethrough
= false
][,
bool $overline
= false
][,
bool $clip
= false
][,
bool $drawcell
= true
][,
string $forcedir
= ''
][,
TextShadow|null $shadow
= null
]) : string
Parameters
- $txt : string
-
Text string to be processed.
- $posx : float = 0
-
Abscissa of upper-left corner.
- $posy : float = 0
-
Ordinate of upper-left corner.
- $width : float = 0
-
Width.
- $height : float = 0
-
Height.
- $offset : float = 0
-
Horizontal offset to apply to the line start.
- $linespace : float = 0
-
Additional space to add between lines.
- $valign : string = 'C'
-
Text vertical alignment inside the cell: T=top; C=center; B=bottom.
- $halign : string = 'C'
-
Text horizontal alignment inside the cell: L=left; C=center; R=right; J=justify.
- $cell : TCellDef|null = null
-
Optional to overwrite cell parameters for padding, margin etc.
- $styles : array<int, StyleDataOpt> = []
-
Cell border styles (see: getCurrentStyleArray).
- $strokewidth : float = 0
-
Stroke width.
- $wordspacing : float = 0
-
Word spacing (use it only when justify == false).
- $leading : float = 0
-
Leading.
- $rise : float = 0
-
Text rise.
- $jlast : bool = true
-
If true does not justify the last line when $halign == J.
- $fill : bool = true
-
If true fills the text.
- $stroke : bool = false
-
If true stroke the text.
- $underline : bool = false
-
If true underline the text.
- $linethrough : bool = false
-
If true line through the text.
- $overline : bool = false
-
If true overline the text.
- $clip : bool = false
-
If true activate clipping mode.
- $drawcell : bool = true
-
If true draw the cell border.
- $forcedir : string = ''
-
If 'R' forces RTL, if 'L' forces LTR.
- $shadow : TextShadow|null = null
-
Text shadow parameters.
Return values
stringgetTextLine()
Returns the PDF code to render a single line of text.
public getTextLine(string $txt[,
float $posx
= 0
][,
float $posy
= 0
][,
float $width
= 0
][,
float $strokewidth
= 0
][,
float $wordspacing
= 0
][,
float $leading
= 0
][,
float $rise
= 0
][,
bool $fill
= true
][,
bool $stroke
= false
][,
bool $underline
= false
][,
bool $linethrough
= false
][,
bool $overline
= false
][,
bool $clip
= false
][,
string $forcedir
= ''
][,
TextShadow|null $shadow
= null
]) : string
Parameters
- $txt : string
-
Text string to be processed.
- $posx : float = 0
-
X position relative to the start of the current line.
- $posy : float = 0
-
Y position relative to the start of the current line (font baseline).
- $width : float = 0
-
Desired string width to force justification via word spacing (0 = automatic).
- $strokewidth : float = 0
-
Stroke width.
- $wordspacing : float = 0
-
Word spacing (use it only when width == 0).
- $leading : float = 0
-
Leading.
- $rise : float = 0
-
Text rise.
- $fill : bool = true
-
If true fills the text.
- $stroke : bool = false
-
If true stroke the text.
- $underline : bool = false
-
If true underline the text.
- $linethrough : bool = false
-
If true line through the text.
- $overline : bool = false
-
If true overline the text.
- $clip : bool = false
-
If true activate clipping mode.
- $forcedir : string = ''
-
If 'R' forces RTL, if 'L' forces LTR.
- $shadow : TextShadow|null = null
-
Text shadow parameters.
Return values
stringloadTexHyphenPatterns()
Returns an array of hyphenation patterns.
public loadTexHyphenPatterns(string $file)
: array<string,
string>
Parameters
- $file : string
-
TEX file containing hypenation patterns. TEX patterns can be downloaded from https://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/tex See https://www.ctan.org/tex-archive/language/hyph-utf8/ for more information.
Return values
array<string, string> —Array of hyphenation patterns.
setDefaultCellBorderPos()
Sets the default cell border position.
public setDefaultCellBorderPos(float $borderpos)
: void
Parameters
- $borderpos : float
-
The border position to set: BORDERPOS_DEFAULT BORDERPOS_EXTERNAL BORDERPOS_INTERNAL
setDefaultCellMargin()
Set the default cell margin in user units.
public setDefaultCellMargin(float $top,
float $right,
float $bottom,
float $left)
: void
Parameters
- $top : float
-
Top.
- $right : float
-
Right.
- $bottom : float
-
Bottom.
- $left : float
-
Left.
setDefaultCellPadding()
Set the default cell padding in user units.
public setDefaultCellPadding(float $top,
float $right,
float $bottom,
float $left)
: void
Parameters
- $top : float
-
Top.
- $right : float
-
Right.
- $bottom : float
-
Bottom.
- $left : float
-
Left.
setPointToPixelRatio()
Set the pixel/point ratio used to convert pixel values to points.
public setPointToPixelRatio(float $val)
: void
Parameters
- $val : float
setTexHyphenPatterns()
Sets the hyphen patterns for text.
public setTexHyphenPatterns(array<string,
string> $patterns)
: void
Parameters
- $patterns : array<string, string>
-
Array of hyphenation patterns.
Tags
toPoints()
Convert user units to internal points unit.
public toPoints(float $usr)
: float
Parameters
- $usr : float
-
Value to convert.
Return values
floattoUnit()
Convert internal points to user unit.
public toUnit(float $pnt)
: float
Parameters
- $pnt : float
-
Value to convert in user units.
Return values
floattoYPoints()
Convert vertical user value to internal points unit.
public toYPoints(float $usr[,
float $pageh
= -1
]) : float
Note: the internal Y points coordinate starts at the bottom left of the page.
Parameters
- $usr : float
-
Value to convert.
- $pageh : float = -1
-
Optional page height in internal points ($pageh:$this->page->getPage()['pheight']).
Return values
floattoYUnit()
Convert vertical internal points value to user unit.
public toYUnit(float $pnt[,
float $pageh
= -1
]) : float
Note: the internal Y points coordinate starts at the bottom left of the page.
Parameters
- $pnt : float
-
Value to convert.
- $pageh : float = -1
-
Optional page height in internal points ($pageh:$this->page->getPage()['pheight']).