Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
Fpdi Class Reference

Class Fpdi. More...

Inheritance diagram for Fpdi:
FpdfTpl pdf FpdfTpl

Public Member Functions

 get_export_fontlist ()
 Get font list from config.
 
 get_font_families ()
 Returns list of font families and types of fonts.
 
 getTemplateSize ($tpl, $width=null, $height=null)
 Get the size of an imported page.
 
 is_core_font_family ($fontfamily)
 Is this font family one of core fonts?
 
 Output ($name='doc.pdf', $dest='I')
 Send the document to a given destination: string, local file or browser.
 
 useImportedPage ($pageId, $x=0, $y=0, $width=null, $height=null, $adjustPageSize=false)
 Draws an imported page onto the page.
 
 useTemplate ($tpl, $x=0, $y=0, $width=null, $height=null, $adjustPageSize=false)
 Draws an imported page onto the page or another template.
 

Public Attributes

useImportedPage as fpdiUseImportedPage
 
const VERSION = '2.6.0'
 FPDI version.
 

Protected Member Functions

 _enddoc ()
 
 _getxobjectdict ()
 
 _newobj ($objid='')
 Begin a new object and return the object number.
 
 _put ($s, $newLine=true)
 Append content to the buffer of TCPDF.
 
 _putxobjects ()
 
 adjustLastLink ($externalLink, $xPt, $scaleX, $yPt, $newHeightPt, $scaleY, $importedPage)
 This method will add additional data to the last created link/annotation.
 
 getNextTemplateId ()
 Get the next template id.
 
 writePdfType (PdfType $value)
 Writes a PdfType object to the resulting buffer.
 

Protected Attributes

int null $currentObjectNumber
 The currently used object number.
 
int $templateId = 0
 A counter for template ids.
 

Detailed Description

Class Fpdi.

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

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

@method _encrypt_data(int $n, string $s) string

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

Member Function Documentation

◆ _getxobjectdict()

Fpdi::_getxobjectdict ( )
protected

Return values
string

◆ _newobj()

Fpdi::_newobj ( $objid = '')
protected

Begin a new object and return the object number.

Parameters
int | string$objidObject ID (leave empty to get a new ID).
Return values
intobject number

◆ _put()

Fpdi::_put ( $s,
$newLine = true )
protected

Append content to the buffer of TCPDF.

Parameters
string$s
bool$newLine

◆ _putxobjects()

Fpdi::_putxobjects ( )
protected

◆ adjustLastLink()

Fpdi::adjustLastLink ( $externalLink,
$xPt,
$scaleX,
$yPt,
$newHeightPt,
$scaleY,
$importedPage )
protected

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
array$externalLink
float | int$xPt
float | int$scaleX
float | int$yPt
float | int$newHeightPt
float | int$scaleY
array$importedPage
Return values
void

◆ get_export_fontlist()

pdf::get_export_fontlist ( )
inherited

Get font list from config.

Return values
array|string[]

◆ get_font_families()

pdf::get_font_families ( )
inherited

Returns list of font families and types of fonts.

Return values
arraymultidimensional array with font families as keys and B, I, BI and N as values.

◆ getNextTemplateId()

Fpdi::getNextTemplateId ( )
protected

Get the next template id.

Return values
int

◆ getTemplateSize()

Fpdi::getTemplateSize ( $tpl,
$width = null,
$height = null )

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
mixed$tplThe template id
float | int | null$widthThe width.
float | int | null$heightThe height.
Return values
array|boolAn array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P)

◆ is_core_font_family()

pdf::is_core_font_family ( $fontfamily)
inherited

Is this font family one of core fonts?

Parameters
string$fontfamily
Return values
bool

◆ Output()

pdf::Output ( $name = 'doc.pdf',
$dest = 'I' )
inherited

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.
The method first calls Close() if necessary to terminate the document.

Parameters
$name(string) The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
$dest(string) Destination where to send the document. It can take one of the following values:
  • 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.
  • D: send to the browser and force a file download with the name given by name.
  • F: save to a local server file with the name given by name.
  • S: return the document as a string (name is ignored).
  • FI: equivalent to F + I option
  • FD: equivalent to F + D option
  • E: return the document as base64 mime multi-part email attachment (RFC 2045)
Since
Moodle 1.0
See also
Close()

◆ useImportedPage()

Fpdi::useImportedPage ( $pageId,
$x = 0,
$y = 0,
$width = null,
$height = null,
$adjustPageSize = false )

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
mixed$pageIdThe page id
float | int | array$xThe abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".
float | int$yThe ordinate of upper-left corner.
float | int | null$widthThe width.
float | int | null$heightThe height.
bool$adjustPageSize
Return values
arrayThe size.
See also
Fpdi\getTemplateSize()

◆ useTemplate()

Fpdi::useTemplate ( $tpl,
$x = 0,
$y = 0,
$width = null,
$height = null,
$adjustPageSize = false )

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
mixed$tplThe template id
float | int | array$xThe abscissa of upper-left corner. Alternatively you could use an assoc array with the keys "x", "y", "width", "height", "adjustPageSize".
float | int$yThe ordinate of upper-left corner.
float | int | null$widthThe width.
float | int | null$heightThe height.
bool$adjustPageSize
Return values
arrayThe size
See also
FpdiTrait\getTemplateSize()

◆ writePdfType()

Fpdi::writePdfType ( PdfType $value)
protected

Writes a PdfType object to the resulting buffer.

Parameters
PdfType$value
Exceptions
PdfTypeException

Member Data Documentation

◆ VERSION

const Fpdi::VERSION = '2.6.0'

FPDI version.

@string


The documentation for this class was generated from the following files: