TCPDF extends AbstractRenderer implements WriterInterface
TCPDF writer
Tags
Interfaces, Classes and Traits
- WriterInterface
- Writer interface
Table of Contents
- $font : string
- Font
- $includeFile : string
- Name of renderer include file
- $isPdf : bool
- Is the current writer creating PDF?
- $mediaPaths : array<string|int, mixed>
- Paths to store media files
- $notes : array<string|int, mixed>
- Footnotes and endnotes collection
- $orientation : string
- Orientation
- $paperSize : int
- Paper size
- $paperSizes : array<string|int, mixed>
- Paper Sizes xRef List
- $parts : array<string|int, mixed>
- Part name and file name pairs
- $phpWord : PhpWord
- PHPWord object
- $writerParts : array<string|int, mixed>
- Individual writers
- $diskCachingDirectory : string
- Disk caching directory
- $originalFilename : string
- Original file name
- $tempDir : string
- Temporary directory
- $tempFilename : string
- Temporary file name
- $useDiskCaching : bool
- Use disk caching
- __construct() : mixed
- Create new instance
- addNote() : mixed
- Add note.
- getContent() : string
- Get content
- getDiskCachingDirectory() : string
- Get disk caching directory
- getFont() : string
- Get Font
- getNotes() : array<string|int, mixed>
- Get notes
- getOrientation() : string
- Get Orientation
- getPaperSize() : int
- Get Paper Size
- getPhpWord() : PhpWord
- Get PhpWord object
- getTempDir() : string
- Get temporary directory
- getUseDiskCaching() : mixed
- Get use disk caching status
- getWriterPart() : mixed
- Get writer part
- isPdf() : bool
- Get is PDF
- isUseDiskCaching() : bool
- Get use disk caching status
- save() : mixed
- Save PhpWord to file.
- setFont() : self
- Set font. Examples: 'arialunicid0-chinese-simplified' 'arialunicid0-chinese-traditional' 'arialunicid0-korean' 'arialunicid0-japanese'
- setOrientation() : self
- Set Orientation
- setPaperSize() : self
- Set Paper Size
- setPhpWord() : self
- Set PhpWord object
- setTempDir() : self
- Set temporary directory
- setUseDiskCaching() : self
- Set use disk caching status
- writeDocument() : string
- Write document
- addFilesToPackage() : mixed
- Add files to package.
- addFileToPackage() : mixed
- Add file to package.
- cleanupTempFile() : mixed
- Cleanup temporary file.
- clearTempDir() : mixed
- Clear temporary directory.
- createExternalWriterInstance() : TCPDF
- Gets the implementation of external PDF library that should be used.
- getTempFile() : string
- Get temporary file name
- getZipArchive() : ZipArchive
- Get ZipArchive object
- openFile() : resource
- Open file for writing
- prepareForSave() : resource
- Save PhpWord to PDF file, pre-save
- restoreStateAfterSave() : mixed
- Save PhpWord to PDF file, post-save
- writeFile() : mixed
- Write content to file.
- deleteDir() : mixed
- Delete directory.
Properties
$font
Font
protected
string
$font
$includeFile
Name of renderer include file
protected
string
$includeFile
= 'tcpdf.php'
$isPdf
Is the current writer creating PDF?
protected
bool
$isPdf
= false
$mediaPaths
Paths to store media files
protected
array<string|int, mixed>
$mediaPaths
= array('image' => '', 'object' => '')
$notes
Footnotes and endnotes collection
protected
array<string|int, mixed>
$notes
= array()
$orientation
Orientation
protected
string
$orientation
$paperSize
Paper size
protected
int
$paperSize
$paperSizes
Paper Sizes xRef List
protected
static array<string|int, mixed>
$paperSizes
= array(9 => 'A4')
$parts
Part name and file name pairs
protected
array<string|int, mixed>
$parts
= array()
$phpWord
PHPWord object
protected
PhpWord
$phpWord
= null
$writerParts
Individual writers
protected
array<string|int, mixed>
$writerParts
= array()
$diskCachingDirectory
Disk caching directory
private
string
$diskCachingDirectory
= './'
$originalFilename
Original file name
private
string
$originalFilename
$tempDir
Temporary directory
private
string
$tempDir
= ''
$tempFilename
Temporary file name
private
string
$tempFilename
$useDiskCaching
Use disk caching
private
bool
$useDiskCaching
= false
Methods
__construct()
Create new instance
public
__construct([PhpWord $phpWord = null ]) : mixed
Parameters
- $phpWord : PhpWord = null
Return values
mixed —addNote()
Add note.
public
addNote(int $noteId, string $noteMark) : mixed
Parameters
- $noteId : int
- $noteMark : string
Return values
mixed —getContent()
Get content
public
getContent() : string
Tags
Return values
string —getDiskCachingDirectory()
Get disk caching directory
public
getDiskCachingDirectory() : string
Return values
string —getFont()
Get Font
public
getFont() : string
Return values
string —getNotes()
Get notes
public
getNotes() : array<string|int, mixed>
Return values
array<string|int, mixed> —getOrientation()
Get Orientation
public
getOrientation() : string
Return values
string —getPaperSize()
Get Paper Size
public
getPaperSize() : int
Return values
int —getPhpWord()
Get PhpWord object
public
getPhpWord() : PhpWord
Tags
Return values
PhpWord —getTempDir()
Get temporary directory
public
getTempDir() : string
Return values
string —getUseDiskCaching()
Get use disk caching status
public
getUseDiskCaching() : mixed
Tags
Return values
mixed —getWriterPart()
Get writer part
public
getWriterPart([string $partName = '' ]) : mixed
Parameters
- $partName : string = ''
-
Writer part name
Return values
mixed —isPdf()
Get is PDF
public
isPdf() : bool
Return values
bool —isUseDiskCaching()
Get use disk caching status
public
isUseDiskCaching() : bool
Return values
bool —save()
Save PhpWord to file.
public
save([string $filename = null ]) : mixed
Parameters
- $filename : string = null
-
Name of the file to save as
Return values
mixed —setFont()
Set font. Examples: 'arialunicid0-chinese-simplified' 'arialunicid0-chinese-traditional' 'arialunicid0-korean' 'arialunicid0-japanese'
public
setFont(string $fontName) : self
Parameters
- $fontName : string
Return values
self —setOrientation()
Set Orientation
public
setOrientation([string $value = 'default' ]) : self
Parameters
- $value : string = 'default'
-
Page orientation ORIENTATION_DEFAULT
Return values
self —setPaperSize()
Set Paper Size
public
setPaperSize([int $value = 9 ]) : self
Parameters
- $value : int = 9
-
Paper size = PAPERSIZE_A4
Return values
self —setPhpWord()
Set PhpWord object
public
setPhpWord([PhpWord $phpWord = null ]) : self
Parameters
- $phpWord : PhpWord = null
Return values
self —setTempDir()
Set temporary directory
public
setTempDir(string $value) : self
Parameters
- $value : string
Return values
self —setUseDiskCaching()
Set use disk caching status
public
setUseDiskCaching([bool $value = false ][, string $directory = null ]) : self
Parameters
- $value : bool = false
- $directory : string = null
Tags
Return values
self —writeDocument()
Write document
public
writeDocument() : string
Tags
Return values
string —addFilesToPackage()
Add files to package.
protected
addFilesToPackage(ZipArchive $zip, mixed $elements) : mixed
Parameters
- $zip : ZipArchive
- $elements : mixed
Return values
mixed —addFileToPackage()
Add file to package.
protected
addFileToPackage(ZipArchive $zipPackage, string $source, string $target) : mixed
Get the actual source from an archive image.
Parameters
- $zipPackage : ZipArchive
- $source : string
- $target : string
Return values
mixed —cleanupTempFile()
Cleanup temporary file.
protected
cleanupTempFile() : mixed
Tags
Return values
mixed —clearTempDir()
Clear temporary directory.
protected
clearTempDir() : mixed
Return values
mixed —createExternalWriterInstance()
Gets the implementation of external PDF library that should be used.
protected
createExternalWriterInstance(string $orientation, string $unit, string $paperSize) : TCPDF
Parameters
- $orientation : string
-
Page orientation
- $unit : string
-
Unit measure
- $paperSize : string
-
Paper size
Return values
TCPDF —implementation
getTempFile()
Get temporary file name
protected
getTempFile(string $filename) : string
If $filename is php://output or php://stdout, make it a temporary file
Parameters
- $filename : string
Return values
string —getZipArchive()
Get ZipArchive object
protected
getZipArchive(string $filename) : ZipArchive
Parameters
- $filename : string
Tags
Return values
ZipArchive —openFile()
Open file for writing
protected
openFile(string $filename) : resource
Parameters
- $filename : string
Tags
Return values
resource —prepareForSave()
Save PhpWord to PDF file, pre-save
protected
prepareForSave([string $filename = null ]) : resource
Parameters
- $filename : string = null
-
Name of the file to save as
Tags
Return values
resource —restoreStateAfterSave()
Save PhpWord to PDF file, post-save
protected
restoreStateAfterSave(resource $fileHandle) : mixed
Parameters
- $fileHandle : resource
Tags
Return values
mixed —writeFile()
Write content to file.
protected
writeFile(resource $fileHandle, string $content) : mixed
Parameters
- $fileHandle : resource
- $content : string
Tags
Return values
mixed —deleteDir()
Delete directory.
private
deleteDir(string $dir) : mixed
Parameters
- $dir : string