DefaultInvoicePdf extends TcpdfWrapper
Default Invoice Template
Table of Contents
Properties
Methods
| __construct() | Initializes the default invoice PDF |
| drawInvoice() | Draws a complete invoice |
| Footer() | Overwrite the default footer that appears on each page of the PDF |
| Header() | Overwrite the default header that appears on each page of the PDF |
| drawTable() | Draws a table using the given data and options |
| getDateDue() | Fetch the date due to display |
| drawAddress() | Renders the to address information |
| drawBackground() | Renders the background image onto the document |
| drawInvoiceInfo() | Renders the Invoice info section to the document, containing the invoice ID, client ID, date billed, and date due |
| drawInvoiceType() | Sets the invoice type on the document based upon the status of the invoice |
| drawLineHeader() | Renders the line items table heading |
| drawLogo() | Renders the logo onto the document |
| drawPageNumber() | Renders the page number to the document |
| drawPaidWatermark() | Draws the paid text in the background of the invoice |
| drawPaymentHeader() | Renders the transaction payments/credits header onto the document |
| drawPayments() | Renders the transaction payments/credits section onto the document |
| drawReturnAddress() | Renders the return address information |
| drawTableHeading() | Renders a heading, typically above a table |
| drawTallies() | Renders public notes and invoice tallies onto the document |
| drawTaxId() | Renders the tax ID section to the document |
| drawTerms() | Renders the terms of this document |
| setFontInfo() | Set the fonts and font attributes to be used in the document |
Properties
$CurrencyFormat
public
CurrencyFormat
$CurrencyFormat
The CurrencyFormat object used to format currency values
$Date
public
Date
$Date
The Date object used to format date values
$include_address
public
bool
$include_address
= \true
Whether to include the to address or not
$invoice
public
array<string|int, mixed>
$invoice
= []
An array of invoice data for this invoice
$meta
public
array<string|int, mixed>
$meta
= []
An array of meta data for this invoice
$direction
protected
string
$direction
= 'ltr'
The direction of the document
$font
private
string
$font
= 'dejavusanscondensed'
The primary font family to use
$font_size
private
static string
$font_size
= 9
Holds the default font size for this document
$font_size_alt
private
static string
$font_size_alt
= 7
Holds the alternate font size for this document
$font_size_alt2
private
static string
$font_size_alt2
= 10
Holds the second alternate font size for this document
$font_size_alt3
private
static string
$font_size_alt3
= 20
Holds the third alternate font size for this document
$header_end_y
private
int
$header_end_y
= 0
The Y position where the header finishes its content
$line_options
private
array<string|int, mixed>
$line_options
= []
An array of line item options
$payment_options
private
array<string|int, mixed>
$payment_options
= []
An array of transaction payment row options
$primary_color
private
static array<string|int, mixed>
$primary_color
= [175, 176, 177]
An RGB representation of the primary color used throughout
$primary_text_color
private
static array<string|int, mixed>
$primary_text_color
= [83, 84, 86]
An RGB representation of the primary text color used throughout
$standard_num_options
private
static array<string|int, mixed>
$standard_num_options
= ['prefix' => \false, 'suffix' => \false, 'code' => \false, 'with_separator' => \false]
The standard number format options
$table_heading_y_pos
private
int
$table_heading_y_pos
= 233
The y_pos to start the table headings at
Methods
__construct()
Initializes the default invoice PDF
public
__construct([string $orientation = 'P' ][, string $unit = 'mm' ][, string $format = 'A4' ][, bool $unicode = true ][, string $encoding = 'UTF-8' ][, bool $diskcache = false ][, string $font = null ]) : mixed
Parameters
- $orientation : string = 'P'
-
The paper orientation (optional, default 'P')
- $unit : string = 'mm'
-
The measurement unit (optional, default 'mm')
- $format : string = 'A4'
-
The paper format (optional, default 'A4')
- $unicode : bool = true
-
True if the PDF should support unicode characters (optional, default true)
- $encoding : string = 'UTF-8'
-
The character encoding (optional, default 'UTF-8')
- $diskcache : bool = false
-
True to cache results to disk (optional, default false)
- $font : string = null
-
The font to use (optional, default null)
drawInvoice()
Draws a complete invoice
public
drawInvoice() : mixed
Footer()
Overwrite the default footer that appears on each page of the PDF
public
Footer() : mixed
Header()
Overwrite the default header that appears on each page of the PDF
public
Header() : mixed
drawTable()
Draws a table using the given data and options
protected
drawTable([array<string|int, mixed> $data = [] ][, array<string|int, mixed> $options = null ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
An array of 'column' => values
- $options : array<string|int, mixed> = null
-
An array of options affecting the table including:
- type The type of table (multicell or cell, default 'multicell')
- x_pos The X position of the table (default current X post)
- y_pos The Y position of the table (default current Y pos)
- border Border thickness (default 0)
- align Table alignment (default L)
- text_color An RGB array of text color (default null, whatever the default text color is set to)
- font_size The font size for the table (default current font size)
- height The width of the cell(s) (default 0 - auto)
- width The height of the cell(s) (default 0 - to end of screen)
- font The font to set for the cell(s)
- font_style The font style for the cell(s) 'B' = bold, 'I' = italic, 'BI' = bold and italic, 'U' = underlined
- line_style The line style attributes (@see TCPDF::setLineStyle())
- fill_color The color to fill the cell(s) with
- padding The padding value to use for the cell(s) (null - auto padding)
- col All options from $options that affect the given column by name or index
- row All options from $options that affect the given row by index
- cell All options from $options that affect the given cell by both column and row
getDateDue()
Fetch the date due to display
protected
getDateDue() : string
Return values
string —The date due to display
drawAddress()
Renders the to address information
private
drawAddress() : mixed
drawBackground()
Renders the background image onto the document
private
drawBackground() : mixed
drawInvoiceInfo()
Renders the Invoice info section to the document, containing the invoice ID, client ID, date billed, and date due
private
drawInvoiceInfo() : mixed
drawInvoiceType()
Sets the invoice type on the document based upon the status of the invoice
private
drawInvoiceType() : mixed
drawLineHeader()
Renders the line items table heading
private
drawLineHeader() : mixed
drawLogo()
Renders the logo onto the document
private
drawLogo() : mixed
drawPageNumber()
Renders the page number to the document
private
drawPageNumber() : mixed
drawPaidWatermark()
Draws the paid text in the background of the invoice
private
drawPaidWatermark() : mixed
drawPaymentHeader()
Renders the transaction payments/credits header onto the document
private
drawPaymentHeader() : mixed
drawPayments()
Renders the transaction payments/credits section onto the document
private
drawPayments() : mixed
drawReturnAddress()
Renders the return address information
private
drawReturnAddress() : mixed
drawTableHeading()
Renders a heading, typically above a table
private
drawTableHeading(string $heading) : mixed
Parameters
- $heading : string
-
The name of the heading to set
drawTallies()
Renders public notes and invoice tallies onto the document
private
drawTallies() : mixed
drawTaxId()
Renders the tax ID section to the document
private
drawTaxId() : mixed
drawTerms()
Renders the terms of this document
private
drawTerms() : mixed
setFontInfo()
Set the fonts and font attributes to be used in the document
private
setFontInfo(string $font) : mixed
Parameters
- $font : string
-
The font to set