ClassObjects extends Output
in package
Com\Tecnick\Pdf\ClassObjects
External class objects PDF class
Tags
Table of Contents
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
- addTextCol() : void
- Add a text column with automatic line, page and region breaks.
- downloadPDF() : void
- Trigger the browser Download dialog to download the PDF document.
- getLastTextBBox() : TextBBox
- Returns the last text bounding box [llx, lly, urx, ury].
- getMIMEAttachmentPDF() : string
- Returns the PDF as base64 mime multi-part email attachment (RFC 2045).
- getOutPDFString() : string
- Returns the RAW PDF string.
- getTextCell() : string
- Returns the PDF code to render a single text line inside a rectangular cell.
- getTextCol() : string
- Returns the PDF code to render a text in a given column with automatic line breaks.
- getTextLine() : string
- Returns the PDF code to render a single line of text.
- getVersion() : string
- Return the program version.
- loadTexHyphenPatterns() : array<string, string>
- Returns an array of hyphenation patterns.
- renderPDF() : void
- Render the PDF in the browser or output the RAW data in the CLI.
- savePDF() : void
- Save the PDF document to a local file.
- setAuthor() : static
- Defines the author of the document.
- setCreator() : static
- Defines the creator of the document.
- setDefaultCellMargin() : void
- Set the default cell margin in user units.
- setDefaultCellPadding() : void
- Set the default cell padding in user units.
- setExtraXMP() : static
- Set additional XMP data to be appended just before the end of "x:xmpmeta" tag.
- setExtraXMPRDF() : static
- Set additional XMP data to be appended just before the end of "rdf:RDF" tag.
- setKeywords() : static
- Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
- setPDFVersion() : static
- Set the PDF version (check PDF reference for valid values).
- setRTL() : static
- Set the default document language direction.
- setSRGB() : static
- Set the sRGB mode
- setSubject() : static
- Defines the subject of the document.
- setTitle() : static
- Defines the title of the document.
- setViewerPreferences() : static
- Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
- 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.
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
addTextCol()
Add a text column with automatic line, page and region breaks.
public addTextCol(string $txt[,
float $posx
= 0
][,
float $posy
= 0
][,
float $width
= 0
][,
float $offset
= 0
][,
float $linespace
= 0
][,
float $strokewidth
= 0
][,
float $wordspacing
= 0
][,
float $leading
= 0
][,
float $rise
= 0
][,
bool $justify
= false
][,
bool $justifylast
= false
][,
bool $fill
= true
][,
bool $stroke
= false
][,
bool $clip
= false
][,
string $forcedir
= ''
][,
TextShadow|null $shadow
= null
]) : void
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.
- $offset : float = 0
-
Horizontal offset to apply to the line start.
- $linespace : float = 0
-
Additional space to add between lines.
- $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.
- $justify : bool = false
-
If true justify te text via word spacing.
- $justifylast : bool = false
-
If true justify the last line.
- $fill : bool = true
-
If true fills the text.
- $stroke : bool = false
-
If true stroke 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.
downloadPDF()
Trigger the browser Download dialog to download the PDF document.
public downloadPDF([string $rawpdf
= ''
]) : void
Parameters
- $rawpdf : string = ''
-
Raw PDF data string from getOutPDFString().
Tags
getLastTextBBox()
Returns the last text bounding box [llx, lly, urx, ury].
public getLastTextBBox()
: TextBBox
Return values
TextBBox —Array of bounding box values.
getMIMEAttachmentPDF()
Returns the PDF as base64 mime multi-part email attachment (RFC 2045).
public getMIMEAttachmentPDF([string $rawpdf
= ''
]) : string
Parameters
- $rawpdf : string = ''
-
Raw PDF data string from getOutPDFString().
Return values
string —Email attachment as raw string.
getOutPDFString()
Returns the RAW PDF string.
public getOutPDFString()
: string
Return values
stringgetTextCell()
Returns the PDF code to render a single text line inside a rectangular cell.
public getTextCell(string $txt[,
float $posx
= 0
][,
float $posy
= 0
][,
float $width
= 0
][,
float $height
= 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 $justify
= false
][,
bool $fill
= true
][,
bool $stroke
= false
][,
bool $clip
= false
][,
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.
- $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.
- $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.
- $justify : bool = false
-
If true justify te text via word spacing.
- $fill : bool = true
-
If true fills the text.
- $stroke : bool = false
-
If true stroke 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
stringgetTextCol()
Returns the PDF code to render a text in a given column with automatic line breaks.
public getTextCol(string $txt[,
float $posx
= 0
][,
float $posy
= 0
][,
float $width
= 0
][,
float $offset
= 0
][,
float $linespace
= 0
][,
float $strokewidth
= 0
][,
float $wordspacing
= 0
][,
float $leading
= 0
][,
float $rise
= 0
][,
bool $justify
= false
][,
bool $justifylast
= false
][,
bool $fill
= true
][,
bool $stroke
= false
][,
bool $clip
= false
][,
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.
- $offset : float = 0
-
Horizontal offset to apply to the line start.
- $linespace : float = 0
-
Additional space to add between lines.
- $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.
- $justify : bool = false
-
If true justify te text via word spacing.
- $justifylast : bool = false
-
If true justify the last line.
- $fill : bool = true
-
If true fills the text.
- $stroke : bool = false
-
If true stroke 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
string —PDF code to render the text.
getTextLine()
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 $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.
- $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
stringgetVersion()
Return the program version.
public getVersion()
: string
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.
renderPDF()
Render the PDF in the browser or output the RAW data in the CLI.
public renderPDF([string $rawpdf
= ''
]) : void
Parameters
- $rawpdf : string = ''
-
Raw PDF data string from getOutPDFString().
Tags
savePDF()
Save the PDF document to a local file.
public savePDF([string $path
= ''
][,
string $rawpdf
= ''
]) : void
Parameters
- $path : string = ''
-
Path to the output file.
- $rawpdf : string = ''
-
Raw PDF data string from getOutPDFString().
setAuthor()
Defines the author of the document.
public setAuthor(string $author)
: static
Parameters
- $author : string
-
The name of the author.
Return values
staticsetCreator()
Defines the creator of the document.
public setCreator(string $creator)
: static
This is typically the name of the application that generates the PDF.
Parameters
- $creator : string
-
The name of the creator.
Return values
staticsetDefaultCellMargin()
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.
setExtraXMP()
Set additional XMP data to be appended just before the end of "x:xmpmeta" tag.
public setExtraXMP(string $xmp)
: static
IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method.
Parameters
- $xmp : string
-
Custom XMP data.
Return values
staticsetExtraXMPRDF()
Set additional XMP data to be appended just before the end of "rdf:RDF" tag.
public setExtraXMPRDF(string $xmp)
: static
IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method.
Parameters
- $xmp : string
-
Custom XMP data.
Return values
staticsetKeywords()
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
public setKeywords(string $keywords)
: static
Parameters
- $keywords : string
-
Space-separated list of keywords.
Return values
staticsetPDFVersion()
Set the PDF version (check PDF reference for valid values).
public setPDFVersion([string $version
= '1.7'
]) : static
Parameters
- $version : string = '1.7'
-
PDF document version.
Tags
Return values
staticsetRTL()
Set the default document language direction.
public setRTL(bool $enabled)
: static
Parameters
- $enabled : bool
-
False = LTR = Left-To-Right; True = RTL = Right-To-Left.
Return values
staticsetSRGB()
Set the sRGB mode
public setSRGB(bool $enabled)
: static
Parameters
- $enabled : bool
-
Set to true to add the default sRGB ICC color profile
Return values
staticsetSubject()
Defines the subject of the document.
public setSubject(string $subject)
: static
Parameters
- $subject : string
-
The subject.
Return values
staticsetTitle()
Defines the title of the document.
public setTitle(string $title)
: static
Parameters
- $title : string
-
The title.
Return values
staticsetViewerPreferences()
Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
public setViewerPreferences(TViewerPref $pref)
: static
Parameters
- $pref : TViewerPref
-
Array of options (see PDF reference "Viewer Preferences").
Return values
statictoPoints()
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']).