Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 403]

This file is part of FPDI

Copyright: Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
License: http://opensource.org/licenses/mit-license The MIT License
File Size: 270 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Fpdi:: (10 methods):
  _enddoc()
  getNextTemplateId()
  useTemplate()
  useImportedPage()
  getTemplateSize()
  _getxobjectdict()
  _putxobjects()
  _put()
  _newobj()
  writePdfType()


Class: Fpdi  - X-Ref

Class Fpdi

This class let you import pages of existing PDF documents into a reusable structure for TCPDF.

_enddoc()   X-Ref
The currently used object number.


getNextTemplateId()   X-Ref
Get the next template id.

return: int

useTemplate($tpl, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false)   X-Ref
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.

return: array The size
param: mixed $tpl The template id
param: float|int|array $x The abscissa of upper-left corner. Alternatively you could use an assoc array
param: float|int $y The ordinate of upper-left corner.
param: float|int|null $width The width.
param: float|int|null $height The height.
param: bool $adjustPageSize

useImportedPage($pageId, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false)   X-Ref
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.

return: array The size.
param: mixed $pageId The page id
param: float|int|array $x The abscissa of upper-left corner. Alternatively you could use an assoc array
param: float|int $y The ordinate of upper-left corner.
param: float|int|null $width The width.
param: float|int|null $height The height.
param: bool $adjustPageSize

getTemplateSize($tpl, $width = null, $height = null)   X-Ref
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.

return: array|bool An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)
param: mixed $tpl The template id
param: float|int|null $width The width.
param: float|int|null $height The height.

_getxobjectdict()   X-Ref


_putxobjects()   X-Ref


_put($s, $newLine = true)   X-Ref
Append content to the buffer of TCPDF.

param: string $s
param: bool $newLine

_newobj($objid = '')   X-Ref
Begin a new object and return the object number.

return: int object number
param: int|string $objid Object ID (leave empty to get a new ID).

writePdfType(PdfType $value)   X-Ref
Writes a PdfType object to the resulting buffer.

param: PdfType $value