Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

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: 554 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 10 functions


Functions that are not part of a class:

cleanUp($allReaders = false)   X-Ref
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.

param: bool $allReaders

setMinPdfVersion($pdfVersion)   X-Ref
Set the minimal PDF version.

param: string $pdfVersion

getPdfParserInstance(StreamReader $streamReader)   X-Ref
Get a new pdf parser instance.

param: StreamReader $streamReader
return: PdfParser|FpdiPdfParser

getPdfReaderId($file)   X-Ref
Get an unique reader id by the $file parameter.

param: string|resource|PdfReader|StreamReader $file An open file descriptor, a path to a file, a PdfReader
return: string

getPdfReader($id)   X-Ref
Get a pdf reader instance by its id.

param: string $id
return: PdfReader

setSourceFile($file)   X-Ref
Set the source PDF file.

param: string|resource|StreamReader $file Path to the file or a stream resource or a StreamReader instance.
return: int The page count of the PDF document.

importPage($pageNumber, $box = PageBoundaries::CROP_BOX, $groupXObject = true)   X-Ref
Imports a page.

param: int $pageNumber The page number.
param: string $box The page boundary to import. Default set to PageBoundaries::CROP_BOX.
param: bool $groupXObject Define the form XObject as a group XObject to support transparency (if used).
return: string A unique string identifying the imported page.

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.

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
return: array The size.

getImportedPageSize($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.

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

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

param: PdfType $value