setasign\Fpdi\Tcpdf
Fpdi Class Fpdi
File: /FPDI v2/Tcpdf/Fpdi.php
This class let you import pages of existing PDF documents into a reusable structure for TCPDF.
Class hierarchy
Uses
Summary
Methods
- _enddoc()
- _getxobjectdict()
- _newobj()
- _put()
- _putxobjects()
- adjustLastLink()
- cleanUp()
- fpdiUseImportedPage()
- fpdiWritePdfType()
- getImportedPageSize()
- getNextTemplateId()
- getPdfParserInstance()
- getPdfReader()
- getPdfReaderId()
- getTemplateSize()
- importPage()
- setMinPdfVersion()
- setSourceFile()
- setSourceFileWithParserParams()
- useImportedPage()
- useTemplate()
- writePdfType()
Constants
VERSION
Properties
$currentObjectNumber
The currently used object number.
$currentReaderId
The current reader id.
$objectsToCopy
An array with information about objects, which needs to be copied to the resulting document.
Methods
_putxobjects()
Exceptions
Throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException
adjustLastLink()
This method will add additional data to the last created link/annotation.
It will copy styling properties (supported by TCPDF) of the imported link.
Parameters
- $externalLink : array
- $xPt : float|int
- $scaleX : float|int
- $yPt : float|int
- $newHeightPt : float|int
- $scaleY : float|int
- $importedPage : array
cleanUp()
Release resources and file handles.
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
fpdiUseImportedPage()
Draws an imported page onto the page.
Give only 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
The abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".
- $y : float|int
The ordinate of upper-left corner.
- $width : float|int|null
The width.
- $height : float|int|null
The height.
- $adjustPageSize : bool
Return Values
The size.
See
fpdiWritePdfType()
Writes a PdfType object to the resulting buffer.
Parameters
Exceptions
getImportedPageSize()
Get the size of an imported page.
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
The width.
- $height : float|int|null
The height.
Return Values
An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)
getPdfParserInstance()
Get a new pdf parser instance.
Parameters
- $streamReader : \setasign\Fpdi\PdfParser\StreamReader
- $parserParams : array
Individual parameters passed to the parser instance.
getPdfReaderId()
Get an unique reader id by the $file parameter.
Parameters
- $file : string|resource|\setasign\Fpdi\PdfReader\PdfReader|\setasign\Fpdi\PdfParser\StreamReader
An open file descriptor, a path to a file, a PdfReader instance or a StreamReader instance.
- $parserParams : array
Individual parameters passed to the parser instance.
getTemplateSize()
Get the size of an imported page.
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
The width.
- $height : float|int|null
The height.
Return Values
An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)
importPage()
Imports a page.
Parameters
- $pageNumber : int
The page number.
- $box : string
The page boundary to import. Default set to PageBoundaries::CROP_BOX.
- $groupXObject : bool
Define the form XObject as a group XObject to support transparency (if used).
- $importExternalLinks : bool
Define whether external links are imported or not.
Return Values
A unique string identifying the imported page.
Exceptions
Throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException
Throws \setasign\Fpdi\PdfParser\Filter\FilterException
Throws \setasign\Fpdi\PdfParser\PdfParserException
Throws \setasign\Fpdi\PdfParser\Type\PdfTypeException
Throws \setasign\Fpdi\PdfReader\PdfReaderException
See
- PageBoundaries
setSourceFile()
Set the source PDF file.
Parameters
- $file : string|resource|\setasign\Fpdi\PdfParser\StreamReader
Path to the file or a stream resource or a StreamReader instance.
Return Values
The page count of the PDF document.
Exceptions
setSourceFileWithParserParams()
Set the source PDF file with parameters which are passed to the parser instance.
This method allows us to pass e.g. authentication information to the parser instance.
Parameters
- $file : string|resource|\setasign\Fpdi\PdfParser\StreamReader
Path to the file or a stream resource or a StreamReader instance.
- $parserParams : array
Individual parameters passed to the parser instance.
Return Values
The page count of the PDF document.
Exceptions
Throws \setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException
useImportedPage()
Draws an imported page onto the page.
Give only 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
The abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".
- $y : float|int
The ordinate of upper-left corner.
- $width : float|int|null
The width.
- $height : float|int|null
The height.
- $adjustPageSize : bool
Return Values
The size.
See
useTemplate()
Draws an imported page onto the page or another template.
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
- $x : float|int|array
The abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".
- $y : float|int
The ordinate of upper-left corner.
- $width : float|int|null
The width.
- $height : float|int|null
The height.
- $adjustPageSize : bool
Return Values
The size
See
- \setasign\Fpdi\Tcpdf\FpdiTrait::getTemplateSize()