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.
/lib/ -> pdflib.php (source)

Differences Between: [Versions 311 and 402] [Versions 311 and 403]

pdflib.php - Moodle PDF library We currently use the TCPDF library by Nicola Asuni.

Copyright: Vy-Shane Sin Fat
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 253 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 lib/tcpdf/tcpdf.php

Defines 1 class

pdf:: (4 methods):
  __construct()
  Output()
  is_core_font_family()
  get_font_families()

Defines 4 functions


Class: pdf  - X-Ref

Wrapper class that extends TCPDF (lib/tcpdf/tcpdf.php).
Moodle customisations are done here.

__construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8')   X-Ref
Class constructor

See the parent class documentation for the parameters info.

Output($name='doc.pdf', $dest='I')   X-Ref
Send the document to a given destination: string, local file or browser.
In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.<br />
The method first calls Close() if necessary to terminate the document.

param: $name (string) The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
param: $dest (string) Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local server file with the name given by name.</li><li>S: return the document as a string (name is ignored).</li><li>FI: equivalent to F + I option</li><li>FD: equivalent to F + D option</li><li>E: return the document as base64 mime multi-part email attachment (RFC 2045)</li></ul>

is_core_font_family($fontfamily)   X-Ref
Is this font family one of core fonts?

param: string $fontfamily
return: bool

get_font_families()   X-Ref
Returns list of font families and types of fonts.

return: array multidimensional array with font families as keys and B, I, BI and N as values.

Functions that are not part of a class:

tcpdf_init_k_font_path()   X-Ref
Init K_PATH_FONTS and PDF_FONT_NAME_MAIN constant.

Unfortunately this hack is necessary because the constants need
to be defined before inclusion of the tcpdf.php file.