Com\Tecnick\Pdf\Tcpdf
Tcpdf PDF class
Tags
Table of Contents
- $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
- $uniconv : Convert
- Unicode Convert object
- $author : string
- The name of the person who created the document.
- $creator : string
- The name of the application that generates the PDF.
- $custom_xmp : string
- Additional XMP data to be appended just before the end of "x:xmpmeta" tag.
- $custom_xmp_rdf : string
- Additional XMP RDF data to be appended just before the end of "rdf:RDF" tag.
- $display : string
- Defines the way the document is to be displayed by the viewer.
- $docmodtime : int
- Time is seconds since EPOCH when the document was modified.
- $doctime : int
- Time is seconds since EPOCH when the document was created.
- $embeddedfiles : array<string|int, mixed>
- Embedded files data
- $encoding : string
- Document encoding
- $fileid : string
- Document ID
- $isunicode : bool
- True for Unicode font mode
- $keywords : string
- Space-separated list of keywords associated with the document.
- $kunit : float
- Unit of measure conversion ratio
- $pdfa : int
- Version of the PDF/A mode or 0 otherwise.
- $pdfver : string
- PDF version
- $pdfx : bool
- True if we are in PDF/X mode.
- $pon : int
- Current PDF object number
- $rtl : mixed
- Boolean flag to set the default document language direction.
- $sigapp : bool
- True if the signature approval is enabled (for incremental updates).
- $sign : bool
- True if the document is signed.
- $sRGB : bool
- Set this to TRUE to add the default sRGB ICC color profile
- $subject : string
- Subject of the document.
- $subsetfont : bool
- True to subset the fonts
- $title : string
- Title of the document.
- $unit : string
- Unit of measure
- $valid_zoom : array<string|int, mixed>
- Valid document zoom modes
- $version : string
- TCPDF version.
- $viewerpref : array<string|int, mixed>
- Viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
- __construct() : mixed
- Initialize a new PDF object
- getVersion() : string
- Return the program version.
- setAuthor() : mixed
- Defines the author of the document.
- setCreator() : mixed
- Defines the creator of the document.
- setDisplayMode() : mixed
- Defines the way the document is to be displayed by the viewer.
- setExtraXMP() : mixed
- Set additional XMP data to be appended just before the end of "x:xmpmeta" tag.
- setExtraXMPRDF() : mixed
- Set additional XMP data to be appended just before the end of "rdf:RDF" tag.
- setKeywords() : mixed
- Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
- setPDFVersion() : mixed
- Set the PDF version (check PDF reference for valid values).
- setRTL() : mixed
- Set the default document language direction.
- setSRGB() : mixed
- Set the sRGB mode
- setSubject() : mixed
- Defines the subject of the document.
- setTitle() : mixed
- Defines the title of the document.
- setViewerPreferences() : mixed
- Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
- enableSignatureApproval() : mixed
- Enable or disable the the Signature Approval
- getBooleanMode() : string
- Returns the Viewer Preference boolean entry.
- getDuplexMode() : string
- Returns the Duplex mode for the Viewer Preferences
- getEscapedXML() : string
- Escape some special characters (< > &) for XML output.
- getFormattedDate() : string
- Returns a formatted date for meta information
- getOutDateTimeString() : string
- Returns a formatted date for meta information
- getOutMetaInfo() : string
- Get the PDF output string for the Document Information Dictionary.
- getOutTextString() : string
- Format a text string for output.
- getOutViewerPref() : string
- Returns the PDF viewer preferences for the catalog section
- getOutXMP() : string
- Get the PDF output string for the XMP data object
- getPageBoxName() : string
- Sanitize the page box name and return the default 'CropBox' in case of error.
- getPagePrintScaling() : string
- Sanitize the page box name and return the default 'CropBox' in case of error.
- getProducer() : string
- Returns the producer string
- getXMPFormattedDate() : string
- Returns a formatted date for XMP meta information
- initClassObjects() : mixed
- Initialize class objects
- setNonEmptyFieldValue() : mixed
- Set a field value only if it is not empty.
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
$uniconv
Unicode Convert object
public Convert $uniconv
$author
The name of the person who created the document.
protected string $author = 'TCPDF'
$creator
The name of the application that generates the PDF.
protected string $creator = 'TCPDF'
If the document was converted to PDF from another format, the name of the conforming product that created the original document from which it was converted.
$custom_xmp
Additional XMP data to be appended just before the end of "x:xmpmeta" tag.
protected string $custom_xmp = ''
$custom_xmp_rdf
Additional XMP RDF data to be appended just before the end of "rdf:RDF" tag.
protected string $custom_xmp_rdf =
''
$display
Defines the way the document is to be displayed by the viewer.
protected string $display = array('zoom' =>
'default', 'layout' => 'SinglePage', 'mode' =>
'UseNone')
$docmodtime
Time is seconds since EPOCH when the document was modified.
protected int $docmodtime = 0
$doctime
Time is seconds since EPOCH when the document was created.
protected int $doctime = 0
$embeddedfiles
Embedded files data
protected array<string|int,
mixed> $embeddedfiles =
array()
$encoding
Document encoding
protected string $encoding = 'UTF-8'
$fileid
Document ID
protected string $fileid
$isunicode
True for Unicode font mode
protected bool $isunicode = true
$keywords
Space-separated list of keywords associated with the document.
protected string $keywords = 'TCPDF'
$kunit
Unit of measure conversion ratio
protected float $kunit = 1.0
$pdfa
Version of the PDF/A mode or 0 otherwise.
protected int $pdfa = 0
$pdfver
PDF version
protected string $pdfver = '1.7'
$pdfx
True if we are in PDF/X mode.
protected bool $pdfx = false
$pon
Current PDF object number
protected int $pon = 0
$rtl
Boolean flag to set the default document language direction.
protected mixed $rtl = false
False = LTR = Left-To-Right. True = RTL = Right-To-Left.
Tags
$sigapp
True if the signature approval is enabled (for incremental updates).
protected bool $sigapp = false
$sign
True if the document is signed.
protected bool $sign = false
$sRGB
Set this to TRUE to add the default sRGB ICC color profile
protected bool $sRGB = false
$subject
Subject of the document.
protected string $subject = '-'
$subsetfont
True to subset the fonts
protected bool $subsetfont = false
$title
Title of the document.
protected string $title = 'PDF
Document'
$unit
Unit of measure
protected string $unit = 'mm'
$valid_zoom
Valid document zoom modes
protected static array<string|int,
mixed> $valid_zoom = array('fullpage',
'fullwidth', 'real', 'default')
$version
TCPDF version.
protected string $version = '8.0.11'
$viewerpref
Viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
protected array<string|int,
mixed> $viewerpref = array()
(Section 8.1 of PDF reference, "Viewer Preferences").
Methods
__construct()
Initialize a new PDF object
public __construct([string $unit
= 'mm'
][,
bool $isunicode
= true
][,
bool $subsetfont
= false
][,
string $mode
= ''
][,
Encrypt $encobj
= null
]) : mixed
Parameters
- $unit : string = 'mm'
-
Unit of measure ('pt', 'mm', 'cm', 'in')
- $isunicode : bool = true
-
True if the document is in Unicode mode
- $subsetfont : bool = false
-
If true subset the embedded fonts to remove the unused characters
- $mode : string = ''
-
PDF mode: "pdfa1", "pdfa2", "pdfa3", "pdfx" or empty
- $encobj : Encrypt = null
-
Encryption object
Return values
mixed —getVersion()
Return the program version.
public getVersion()
: string
Return values
string —setAuthor()
Defines the author of the document.
public setAuthor(string $author)
: mixed
Parameters
- $author : string
-
The name of the author.
Return values
mixed —setCreator()
Defines the creator of the document.
public setCreator(string $creator)
: mixed
This is typically the name of the application that generates the PDF.
Parameters
- $creator : string
-
The name of the creator.
Return values
mixed —setDisplayMode()
Defines the way the document is to be displayed by the viewer.
public setDisplayMode([mixed $zoom
= 'default'
][,
string $layout
= 'SinglePage'
][,
string $mode
= 'UseNone'
]) : mixed
Parameters
- $zoom : mixed = 'default'
-
The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use.
- fullpage: displays the entire page on screen
- fullwidth: uses maximum width of window
- real: uses real size (equivalent to 100% zoom)
- default: uses viewer default mode
- $layout : string = 'SinglePage'
-
The page layout. Possible values are:
- SinglePage Display one page at a time
- OneColumn Display the pages in one column
- TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
- TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
- TwoPageLeft Display the pages two at a time, with odd-numbered pages on the left
- TwoPageRight Display the pages two at a time, with odd-numbered pages on the right
- $mode : string = 'UseNone'
-
A name object specifying how the document should be displayed when opened:
- UseNone Neither document outline nor thumbnail images visible
- UseOutlines Document outline visible
- UseThumbs Thumbnail images visible
- FullScreen Full screen, with no menu bar, window controls, or any other window visible
- UseOC (PDF 1.5) Optional content group panel visible
- UseAttachments (PDF 1.6) Attachments panel visible
Return values
mixed —setExtraXMP()
Set additional XMP data to be appended just before the end of "x:xmpmeta" tag.
public setExtraXMP(string $xmp)
: mixed
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
mixed —setExtraXMPRDF()
Set additional XMP data to be appended just before the end of "rdf:RDF" tag.
public setExtraXMPRDF(string $xmp)
: mixed
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
mixed —setKeywords()
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
public setKeywords(string $keywords)
: mixed
Parameters
- $keywords : string
-
Space-separated list of keywords.
Return values
mixed —setPDFVersion()
Set the PDF version (check PDF reference for valid values).
public setPDFVersion([string $version
= '1.7'
]) : mixed
Parameters
- $version : string = '1.7'
-
PDF document version.
Tags
Return values
mixed —setRTL()
Set the default document language direction.
public setRTL(bool $enabled)
: mixed
Parameters
- $enabled : bool
-
False = LTR = Left-To-Right; True = RTL = Right-To-Left.
Return values
mixed —setSRGB()
Set the sRGB mode
public setSRGB(bool $enabled)
: mixed
Parameters
- $enabled : bool
-
Set to true to add the default sRGB ICC color profile
Return values
mixed —setSubject()
Defines the subject of the document.
public setSubject(string $subject)
: mixed
Parameters
- $subject : string
-
The subject.
Return values
mixed —setTitle()
Defines the title of the document.
public setTitle(string $title)
: mixed
Parameters
- $title : string
-
The title.
Return values
mixed —setViewerPreferences()
Set the viewer preferences dictionary controlling the way the document is to be presented on the screen or in print.
public setViewerPreferences(array<string|int,
mixed> $pref)
: mixed
Parameters
- $pref : array<string|int, mixed>
-
Array of options (see Section 12.2 of PDF reference, "Viewer Preferences").
Return values
mixed —enableSignatureApproval()
Enable or disable the the Signature Approval
protected enableSignatureApproval([bool $enabled
= true
]) : mixed
Parameters
- $enabled : bool = true
-
It true enable the Signature Approval
Return values
mixed —getBooleanMode()
Returns the Viewer Preference boolean entry.
protected getBooleanMode(string $name)
: string
Parameters
- $name : string
-
Entry name.
Return values
string —getDuplexMode()
Returns the Duplex mode for the Viewer Preferences
protected getDuplexMode()
: string
Return values
string —getEscapedXML()
Escape some special characters (< > &) for XML output.
protected getEscapedXML(string $str)
: string
Parameters
- $str : string
-
Input string to escape.
Return values
string —getFormattedDate()
Returns a formatted date for meta information
protected getFormattedDate(int $time)
: string
Parameters
- $time : int
-
Time in seconds.
Return values
string —date-time string.
getOutDateTimeString()
Returns a formatted date for meta information
protected getOutDateTimeString(int $time,
int $oid)
: string
Parameters
- $time : int
-
Time in seconds.
- $oid : int
-
Current PDF object number.
Return values
string —escaped date-time string.
getOutMetaInfo()
Get the PDF output string for the Document Information Dictionary.
protected getOutMetaInfo()
: string
(ref. Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf)
Return values
string —getOutTextString()
Format a text string for output.
protected getOutTextString(string $str,
int $oid)
: string
Parameters
- $str : string
-
String to escape.
- $oid : int
-
Current PDF object number.
Return values
string —escaped string.
getOutViewerPref()
Returns the PDF viewer preferences for the catalog section
protected getOutViewerPref()
: string
Return values
string —getOutXMP()
Get the PDF output string for the XMP data object
protected getOutXMP()
: string
Tags
Return values
string —getPageBoxName()
Sanitize the page box name and return the default 'CropBox' in case of error.
protected getPageBoxName(string $name)
: string
Parameters
- $name : string
-
Entry name.
Return values
string —getPagePrintScaling()
Sanitize the page box name and return the default 'CropBox' in case of error.
protected getPagePrintScaling()
: string
Return values
string —getProducer()
Returns the producer string
protected getProducer()
: string
Return values
string —getXMPFormattedDate()
Returns a formatted date for XMP meta information
protected getXMPFormattedDate(int $time)
: string
Parameters
- $time : int
-
Time in seconds.
Return values
string —date-time string.
initClassObjects()
Initialize class objects
protected initClassObjects()
: mixed
Return values
mixed —setNonEmptyFieldValue()
Set a field value only if it is not empty.
private setNonEmptyFieldValue(string $field,
srting $value)
: mixed
Parameters
- $field : string
-
Field name
- $value : srting
-
Value to set