pdf.inc
Interfaces, Classes, Traits and Enums
- PDFEntry
- Common interface for all PDF entries.
- PDFTable
- Represents a table for PDF export.
- PDFTableRow
- Represents a table row for PDF export.
- PDFTableCell
- Represents a table cell for PDF export.
- PDFLabelValue
- Simple PDF object to print label value entries.
- PDFImage
- Adds an image to the PDF file.
Table of Contents
- K_PATH_FONTS = __DIR__ . '/3rdParty/fonts'
- font location
- LAMPDF_FONT_SIZE = 7
- font size
- LAMPDF_FONT_SIZE_BIG = 10
- font size for bigger text
- LAMPDF_FONT_SIZE_TITLE = 20
- font size for page title text
- LAMPDF_IMAGE_WIDTH = 40
- width of an image
- LAMPDF_LABELWIDTH = 50
- width of a label
- LAMPDF_LINEHEIGHT = 5
- line height
- LAMPDF_LINEWIDTH = 190
- line width
- LAMPDF_LOGO_HEIGHT = 15
- height of logo image
- LAMPDF_MARGIN = 10
- margin
- LAMPDF_SPACE_FIELD = 5
- space between fields
- LAMPDF_SPACE_LABEL_VALUE = 1
- space between field label and value
- LAMPDF_SPACE_SECTION = 15
- space between sections
- LAMPDF_SPACE_TITLE_FIELD = 2
- space between title and first field
- LAMPDF_Y_MAX = 297 - 2 * LAMPDF_MARGIN
- line width
- createModulePDF() : string
- This function creates the PDF output of one or more accounts.
- createPdf() : string
- This function creates the PDF output of one or more accounts using TCPDF.
- addPageHeader() : void
- Adds the page header.
- changeFont() : void
- Changes the current font in the PDF.
- getSectionHeadline() : string
- Creates a section headline.
- printLabelValue() : void
- Prints a PDFLabelValue entry.
- printTable() : void
- Prints a PDFTable entry.
- printImage() : void
- Prints an image entry.
- getYWithoutOverflow() : float
- Returns the y-position to use for new cells
- replaceSpecialCharacters() : string
- Replaces special characters that cannot be printed in PDF.
Constants
K_PATH_FONTS
font location
public
mixed
K_PATH_FONTS
= __DIR__ . '/3rdParty/fonts'
LAMPDF_FONT_SIZE
font size
public
mixed
LAMPDF_FONT_SIZE
= 7
LAMPDF_FONT_SIZE_BIG
font size for bigger text
public
mixed
LAMPDF_FONT_SIZE_BIG
= 10
LAMPDF_FONT_SIZE_TITLE
font size for page title text
public
mixed
LAMPDF_FONT_SIZE_TITLE
= 20
LAMPDF_IMAGE_WIDTH
width of an image
public
mixed
LAMPDF_IMAGE_WIDTH
= 40
LAMPDF_LABELWIDTH
width of a label
public
mixed
LAMPDF_LABELWIDTH
= 50
LAMPDF_LINEHEIGHT
line height
public
mixed
LAMPDF_LINEHEIGHT
= 5
LAMPDF_LINEWIDTH
line width
public
mixed
LAMPDF_LINEWIDTH
= 190
LAMPDF_LOGO_HEIGHT
height of logo image
public
mixed
LAMPDF_LOGO_HEIGHT
= 15
LAMPDF_MARGIN
margin
public
mixed
LAMPDF_MARGIN
= 10
LAMPDF_SPACE_FIELD
space between fields
public
mixed
LAMPDF_SPACE_FIELD
= 5
LAMPDF_SPACE_LABEL_VALUE
space between field label and value
public
mixed
LAMPDF_SPACE_LABEL_VALUE
= 1
LAMPDF_SPACE_SECTION
space between sections
public
mixed
LAMPDF_SPACE_SECTION
= 15
LAMPDF_SPACE_TITLE_FIELD
space between title and first field
public
mixed
LAMPDF_SPACE_TITLE_FIELD
= 2
LAMPDF_Y_MAX
line width
public
mixed
LAMPDF_Y_MAX
= 297 - 2 * LAMPDF_MARGIN
Functions
createModulePDF()
This function creates the PDF output of one or more accounts.
createModulePDF(array<string|int, accountContainer> $accounts, string $pdf_structure, string $font[, bool $returnAsString = false ]) : string
Parameters
- $accounts : array<string|int, accountContainer>
-
A numbered array containing all accounts the PDF page should be created for. The entries of the array must be AccountContainer objects.
- $pdf_structure : string
-
The filename of the structure definition that should be used to create the PDF page. If not submitted the 'default.user' structure definition for the appropriate account type.
- $font : string
-
font to use (e.g. DejaVu)
- $returnAsString : bool = false
-
returns the PDF output as String value instead of writing it to a file
Tags
Return values
string —PDF file name
createPdf()
This function creates the PDF output of one or more accounts using TCPDF.
createPdf(PDFStructure $structure, array<string|int, accountContainer> $accounts, array<string|int, string> $pdfKeys, ConfiguredType $account_type, string $font, bool $returnAsString) : string
Parameters
- $structure : PDFStructure
-
PDF structure
- $accounts : array<string|int, accountContainer>
-
A numbered array containing all accounts for the PDF page. The entries of the array must be AccountContainer objects.
- $pdfKeys : array<string|int, string>
-
list of elements in PDF
- $account_type : ConfiguredType
-
account type
- $font : string
-
font to use
- $returnAsString : bool
-
returns the PDF output as a string value instead of writing it to a file
Return values
string —PDF file name
addPageHeader()
Adds the page header.
addPageHeader(Tcpdf $pdf, PDFStructure $structure, string $fontName, array<string, string|int|bool> $pageData, int &$extraTopMargin) : void
Parameters
- $pdf : Tcpdf
-
PDF object
- $structure : PDFStructure
-
PDF structure
- $fontName : string
-
font name
- $pageData : array<string, string|int|bool>
-
page data
- $extraTopMargin : int
-
y-position on PDF page
Return values
void —changeFont()
Changes the current font in the PDF.
changeFont(Tcpdf $pdf, string $fontName[, float $fontSize = LAMPDF_FONT_SIZE ][, string $style = '' ]) : void
Parameters
- $pdf : Tcpdf
-
PDF
- $fontName : string
-
font name
- $fontSize : float = LAMPDF_FONT_SIZE
-
size
- $style : string = ''
-
style (e.g. 'B')
Return values
void —getSectionHeadline()
Creates a section headline.
getSectionHeadline(PDFEntry $entry) : string
Parameters
- $entry : PDFEntry
-
content entry
Return values
string —headline
printLabelValue()
Prints a PDFLabelValue entry.
printLabelValue(Tcpdf $pdf, PDFLabelValue $valueEntry, string $fontName, int $extraTopMargin) : void
Parameters
- $pdf : Tcpdf
-
PDF
- $valueEntry : PDFLabelValue
-
entry
- $fontName : string
-
font name
- $extraTopMargin : int
-
extra top margin
Return values
void —printTable()
Prints a PDFTable entry.
printTable(Tcpdf $pdf, PDFTable $table, string $fontName) : void
Parameters
- $pdf : Tcpdf
-
PDF
- $table : PDFTable
-
entry
- $fontName : string
-
font name
Return values
void —printImage()
Prints an image entry.
printImage(Tcpdf $pdf, PDFImage $imageEntry, array<string, string|int|bool> $pageData) : void
Parameters
- $pdf : Tcpdf
-
PDF
- $imageEntry : PDFImage
-
entry
- $pageData : array<string, string|int|bool>
-
page data
Return values
void —getYWithoutOverflow()
Returns the y-position to use for new cells
getYWithoutOverflow(float|int $posY, Tcpdf $pdf) : float
Parameters
- $posY : float|int
-
calculated y-position of cell
- $pdf : Tcpdf
Return values
float —position to use
replaceSpecialCharacters()
Replaces special characters that cannot be printed in PDF.
replaceSpecialCharacters(string|null $text) : string
Can be removed once tc-lib-pdf is used.
Parameters
- $text : string|null
-
input text
Return values
string —output text