Documentation

FpdiTrait uses trait:short

Tags
mixin

Table of Contents

Properties

$currentObjectNumber  : int
The currently used object number.
$createdReaders  : array<string|int, mixed>
Instances created internally.
$currentReaderId  : string|null
The current reader id.
$importedPages  : array<string|int, mixed>
Data of all imported pages.
$k  : mixed
$objectMap  : array<string|int, mixed>
A map from object numbers of imported objects to new assigned object numbers by FPDF.
$objectsToCopy  : array<string|int, mixed>
An array with information about objects, which needs to be copied to the resulting document.
$readers  : array<string|int, PdfReader>
The pdf reader instances.
$templateId  : int
A counter for template ids.

Methods

cleanUp()  : mixed
Release resources and file handles.
getImportedExternalPageLinks()  : array<string|int, mixed>
Imports the external page links
getImportedPages()  : mixed
getImportedPageSize()  : array<string|int, mixed>|bool
Get the size of an imported page.
getTemplateSize()  : array<string|int, mixed>|bool
Get the size of an imported page or template.
importPage()  : string
Imports a page.
setImportedPageLinks()  : mixed
setSourceFile()  : int
Set the source PDF file.
setSourceFileWithParserParams()  : int
Set the source PDF file with parameters which are passed to the parser instance.
useImportedPage()  : array<string|int, mixed>
Draws an imported page onto the page.
useTemplate()  : array<string|int, mixed>
Draws an imported page or a template onto the page or another template.
writeImportedPagesAndResolvedObjects()  : mixed
writePdfType()  : mixed
Writes a PdfType object to the resulting buffer.
_put()  : mixed
adjustLastLink()  : void
This method will add additional data to the last created link/annotation.
getNextTemplateId()  : int
Get the next template id.
getPdfParserInstance()  : PdfParser|PdfParser
Get a new pdf parser instance.
getPdfReader()  : PdfReader
Get a pdf reader instance by its id.
getPdfReaderId()  : string
Get an unique reader id by the $file parameter.
setMinPdfVersion()  : mixed
Set the minimal PDF version.
setPageFormat()  : mixed

Properties

$currentObjectNumber

The currently used object number.

public int $currentObjectNumber

$createdReaders

Instances created internally.

protected array<string|int, mixed> $createdReaders = []

$currentReaderId

The current reader id.

protected string|null $currentReaderId

$importedPages

Data of all imported pages.

protected array<string|int, mixed> $importedPages = []

$objectMap

A map from object numbers of imported objects to new assigned object numbers by FPDF.

protected array<string|int, mixed> $objectMap = []

$objectsToCopy

An array with information about objects, which needs to be copied to the resulting document.

protected array<string|int, mixed> $objectsToCopy = []

$templateId

A counter for template ids.

protected int $templateId = 0

Methods

cleanUp()

Release resources and file handles.

public cleanUp([bool $allReaders = false ]) : mixed

This method is called internally when the document is created successfully. By default it only cleans up stream reader instances which were created internally.

Parameters
$allReaders : bool = false

getImportedPages()

public getImportedPages() : mixed

getImportedPageSize()

Get the size of an imported page.

public getImportedPageSize(mixed $tpl[, float|int|null $width = null ][, float|int|null $height = null ]) : array<string|int, mixed>|bool

Give only one of the size parameters (width, height) to calculate the other one automatically in view to the aspect ratio.

Parameters
$tpl : mixed

The template id

$width : float|int|null = null

The width.

$height : float|int|null = null

The height.

Return values
array<string|int, mixed>|bool —

An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)

getTemplateSize()

Get the size of an imported page or template.

public getTemplateSize(mixed $tpl[, float|int|null $width = null ][, float|int|null $height = null ]) : array<string|int, mixed>|bool

Omit one of the size parameters (width, height) to calculate the other one automatically in view to the aspect ratio.

Parameters
$tpl : mixed

The template id

$width : float|int|null = null

The width.

$height : float|int|null = null

The height.

Return values
array<string|int, mixed>|bool —

An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)

importPage()

Imports a page.

public importPage(int $pageNumber[, string $box = PageBoundaries::CROP_BOX ][, bool $groupXObject = true ]) : string
Parameters
$pageNumber : int

The page number.

$box : string = PageBoundaries::CROP_BOX

The page boundary to import. Default set to PageBoundaries::CROP_BOX.

$groupXObject : bool = true

Define the form XObject as a group XObject to support transparency (if used).

Tags
throws
CrossReferenceException
throws
FilterException
throws
PdfParserException
throws
PdfTypeException
throws
PdfReaderException
see
PageBoundaries
Return values
string —

A unique string identifying the imported page.

public setImportedPageLinks(mixed $pageId, int|float $x, int|float $y, array<string|int, mixed> $newSize) : mixed
Parameters
$pageId : mixed

The page id

$x : int|float

The abscissa of upper-left corner.

$y : int|float

The ordinate of upper-right corner.

$newSize : array<string|int, mixed>

The size.

setSourceFile()

Set the source PDF file.

public setSourceFile(string|resource|StreamReader $file) : int
Parameters
$file : string|resource|StreamReader

Path to the file or a stream resource or a StreamReader instance.

Tags
throws
PdfParserException
Return values
int —

The page count of the PDF document.

setSourceFileWithParserParams()

Set the source PDF file with parameters which are passed to the parser instance.

public setSourceFileWithParserParams(string|resource|StreamReader $file[, array<string|int, mixed> $parserParams = [] ]) : int

This method allows us to pass e.g. authentication information to the parser instance.

Parameters
$file : string|resource|StreamReader

Path to the file or a stream resource or a StreamReader instance.

$parserParams : array<string|int, mixed> = []

Individual parameters passed to the parser instance.

Tags
throws
CrossReferenceException
throws
PdfParserException
throws
PdfTypeException
Return values
int —

The page count of the PDF document.

useImportedPage()

Draws an imported page onto the page.

public useImportedPage(mixed $pageId[, float|int|array<string|int, mixed> $x = 0 ][, float|int $y = 0 ][, float|int|null $width = null ][, float|int|null $height = null ][, bool $adjustPageSize = false ]) : array<string|int, mixed>

Omit one of the size parameters (width, height) to calculate the other one automatically in view to the aspect ratio.

Parameters
$pageId : mixed

The page id

$x : float|int|array<string|int, mixed> = 0

The abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".

$y : float|int = 0

The ordinate of upper-left corner.

$width : float|int|null = null

The width.

$height : float|int|null = null

The height.

$adjustPageSize : bool = false
Tags
see
Fpdi::getTemplateSize()
Return values
array<string|int, mixed> —

The size.

useTemplate()

Draws an imported page or a template onto the page or another template.

public useTemplate(mixed $tpl[, float|int|array<string|int, mixed> $x = 0 ][, float|int $y = 0 ][, float|int|null $width = null ][, float|int|null $height = null ][, bool $adjustPageSize = false ]) : array<string|int, mixed>

Omit one of the size parameters (width, height) to calculate the other one automatically in view to the aspect ratio.

Parameters
$tpl : mixed

The template id

$x : float|int|array<string|int, mixed> = 0

The abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".

$y : float|int = 0

The ordinate of upper-left corner.

$width : float|int|null = null

The width.

$height : float|int|null = null

The height.

$adjustPageSize : bool = false
Tags
see
Fpdi::getTemplateSize()
Return values
array<string|int, mixed> —

The size

_put()

protected _put(mixed $s[, mixed $newLine = true ]) : mixed
Parameters
$s : mixed
$newLine : mixed = true

This method will add additional data to the last created link/annotation.

protected adjustLastLink(array<string|int, mixed> $externalLink, float|int $xPt, float|int $scaleX, float|int $yPt, float|int $newHeightPt, float|int $scaleY, array<string|int, mixed> $importedPage) : void

It is separated because TCPDF uses its own logic to handle link annotations. This method is overwritten in the TCPDF implementation.

Parameters
$externalLink : array<string|int, mixed>
$xPt : float|int
$scaleX : float|int
$yPt : float|int
$newHeightPt : float|int
$scaleY : float|int
$importedPage : array<string|int, mixed>

getNextTemplateId()

Get the next template id.

protected getNextTemplateId() : int
Return values
int

getPdfParserInstance()

Get a new pdf parser instance.

protected getPdfParserInstance(StreamReader $streamReader[, array<string|int, mixed> $parserParams = [] ]) : PdfParser|PdfParser
Parameters
$streamReader : StreamReader
$parserParams : array<string|int, mixed> = []

Individual parameters passed to the parser instance.

Return values
PdfParser|PdfParser

getPdfReader()

Get a pdf reader instance by its id.

protected getPdfReader(string $id) : PdfReader
Parameters
$id : string
Return values
PdfReader

getPdfReaderId()

Get an unique reader id by the $file parameter.

protected getPdfReaderId(string|resource|PdfReader|StreamReader $file[, array<string|int, mixed> $parserParams = [] ]) : string
Parameters
$file : string|resource|PdfReader|StreamReader

An open file descriptor, a path to a file, a PdfReader instance or a StreamReader instance.

$parserParams : array<string|int, mixed> = []

Individual parameters passed to the parser instance.

Return values
string

setMinPdfVersion()

Set the minimal PDF version.

protected setMinPdfVersion(string $pdfVersion) : mixed
Parameters
$pdfVersion : string

setPageFormat()

protected setPageFormat(mixed $format, mixed $orientation) : mixed
Parameters
$format : mixed
$orientation : mixed

        
On this page

Search results