1. Go to this page and download the library: Download kenod/invoice-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kenod / invoice-generator example snippets
use Kenod\InvoiceGenerator\InvoiceGenerator;
// Create new invoice generator
$invoice = new InvoiceGenerator();
// Set supplier information
$invoice->getSupplier()
->setCompany('My Company s.r.o.')
->setStreet('Main Street 123')
->setCity('Prague')
->setPostalCode('110 00')
->setCompanyId('12345678')
->setTaxId('CZ12345678');
// Set customer information
$invoice->getCustomer()
->setCompany('Customer Ltd.')
->setStreet('Customer Street 456')
->setCity('Brno')
->setPostalCode('602 00');
// Set invoice details
$invoice->getInformation()
->setIssueDate('2024-03-15')
->setDueDate('2024-03-30')
->setTaxableSupplyDate('2024-03-15');
// Set payment details
$invoice->getPaymentDetails()
->setPaymentMethod('Bank transfer')
->setAccountNumber('123456789/0100')
->setVariableSymbol('2024001');
// Configure settings
$invoice->getSettings()
->setInvoiceNumber('2024001')
->setVatPayer(true)
->setCurrency('CZK')
->setLanguage('cs');
// Add invoice items
$invoice->addItem('Web Development', 40, 1500, 'hours', 21);
$invoice->addItem('Hosting Services', 1, 500, 'month', 21);
// Generate and output PDF
$invoice->generate();
// Generate and output the PDF
$invoice->generate(bool $output = true): bool
// Add an invoice item
$invoice->addItem(
string $name, // Item name/description
float $quantity, // Quantity
float $price, // Unit price (without VAT if VAT payer)
string $unit = 'pcs', // Unit of measurement
float $vat = 0, // VAT rate (e.g., 21 for 21%)
string $note = '', // Additional note
int|null $ean = null // EAN barcode
): bool
// Get total price after generation
$invoice->getTotalPrice(): float
// Get final prices with VAT breakdown
$invoice->getFinalPrices(): array
// Returns: ['total' => float, 'vat_summary' => [...]]
// Clear all data for new invoice
$invoice->clearData(): void
// Output PDF directly (advanced usage)
$invoice->outputPDF(string $name = '', string $dest = ''): string
// Set invoice number
->setInvoiceNumber(string $value): self
// Set document type
->setDocumentType(string|int $type): self
// Values: 1/'faktura', 2/'proforma', 3/'odd', 4/'storno'
// Set whether company is VAT payer
->setVatPayer(bool $value): self
// Set currency
->setCurrency(string $currency): self
// Default: 'CZK'
// Set language
->setLanguage(string $language): self
// Available: 'cs', 'sk', 'en'
// Set custom document name
->setDocumentName(string $name): self
// Set PDF author
->setAuthor(string $author): self
// Set PDF title
->setTitle(string $title): self
// Set output filename
->setFilename(string $filename): self
// Set output type
->setOutputType(string $type): self
// Values: 'I' (inline), 'D' (download), 'F' (file),
// 'FI' (file+inline), 'FD' (file+download),
// 'E' (email), 'S' (string)
// Set discount
->setDiscount(
float $discount, // Discount amount or percentage
int $type = 0, // 0=amount, 1=percentage
int $displayLocation = 1, // 0=between items, 1=at total, 2=both
int $showZero = 0, // 0=only non-zero, 1=always show
float $vatRate = 0 // VAT rate to apply discount to
): self
// Set rounding
->setRounding(
int $value, // 0=none, 1=crowns, 2=fifties
int $type = 1, // 1=display only, 2=calculate too, 3=round total
int $method = 1, // 1=mathematical, 2=up, 3=down
int $distribution = 1, // 1=highest rate, 2=lowest, 3=highest total, 4=zero rate
bool $asItem = true // Count rounding as invoice item
): self
// Set deposits/advances already paid
->setDeposits(float $amount): self
// Show/hide the paid advances (deposits) row
->setDisplayDeposits(bool $value): self
// Default: true. When false and deposits are zero, the row is omitted
// and the "total to pay" box moves up to fill the gap. A non-zero
// deposit amount is always shown regardless of this setting.
// Set whether amounts
// Set VAT rates with labels
->setVatRates(array $rates): self
// Example: ['0' => 'Zero rate', '21' => 'Standard rate']
// Get VAT rate label
->getVatRateLabel(float $rate): ?string
// Enable/disable VAT summary display
->setVatSummary(bool $value): self
// Show VAT summary even when empty
->setSummaryEmpty(bool $value): self
// Enable reverse charge VAT
->setReverseCharge(bool $enabled, string $text = ''): self
// Set which columns to display
->setDisplayedColumns(
bool $unit, // Display unit column
bool $quantity, // Display quantity column
bool $unitPrice // Display unit price column
): self
// Set unit column visibility
->setDisplayUnitColumn(bool $value): self
// Display item count in footer
->setDisplayItemCount(bool $value): self
// Set note position
->setNotePosition(string $position): self
// Values: 'top', 'bottom'
// Set spacing between items
->setItemSpacing(float $spacing): self
// Set item underline color
->setUnderline(array|bool $value): self
// Example: [255, 0, 0] for red or false to disable
// Set style colors
->setStyle(string $style, mixed $value): self
// Styles: 'fillColor', 'fontColor', 'itemFillColor',
// 'itemFontColor', 'pricesFillColor', 'pricesFontColor',
// 'signatureFillColor', 'finalRecipientFillColor'
// Value: [R, G, B] array or hex string '#RRGGBB'
// Set font
->setFont(string $fontName): self
// Default: 'dejavusans', also available: 'helvetica', 'times', etc.
// Enable borders around sections
->setBorders(
bool $draw,
float $width = 0.1,
string $color = '000000',
int $dash = 0 // 0=solid, >0=dashed
): self
// Set top margin for page content (pushes supplier/customer section down)
// Useful when using a larger logo in the header area
->setMarginTop(
float $margin, // Top margin in mm
bool $firstPageOnly = true // true=first page only, false=all pages
): self
// Set extra space above the signature line
// Useful when placing a larger stamp or seal above the signature
->setSignatureMarginTop(float $margin): self
// Page breaks are handled automatically — footer height is recalculated
// Add image to invoice
->setImage(
string $path, // Path to image file
float $horizontal, // X position in mm
float|string $vertical, // Y position in mm or 'c-XX' for relative
string $repeat = 'F', // F=first, L=last, A=all pages
?float $width = null, // Width in mm (auto if null)
?float $height = null // Height in mm (auto if null)
): self
// Add text next to signature
->setSignatureText(
string $text,
float $fontSize = 8,
string $style = '' // B=bold, I=italic, U=underline
): self
// Add footer text
->setFooterText(
string $text,
float $fontSize = 8,
string $style = ''
): self
// Configure QR payment code
->setQRPayment(
bool $display, // Show QR code
float $x = 50, // X position in mm
float $y = 50, // Y position in mm
string $page = 'F', // F=first, L=last, PU=payment section, PA=footer
float $size = 20, // QR code size in mm
int $style = 1 // 1=framed+desc below, 2=no frame+desc right, 3=no frame+desc below
): self
// Add barcode to invoice
->setBarcode(
int $code, // Barcode value
float $x = 10, // X position in mm
float $y = 1, // Y position in mm
float $width = 30, // Width in mm
float $height = 10 // Height in mm
): self
// Set signature certificate
->setSignatureCertificate(string $certificate): self
// Can be file path or certificate content
// Set certificate password
->setSignaturePassword(string $password): self
// Set signature metadata
->setSignatureInfo(
string $name = '',
string $location = '',
string $reason = '',
string $contact = ''
): self
// Display final recipient section
->setFinalRecipientDisplay(bool $value): self
// Use different address for final recipient
->setFinalRecipientDifferentAddress(bool $value): self
// Set additional info (for credit notes/storno)
->setAdditionalInfo(
string $originalDocument,
string $reason = ''
): self
// Set EET (Electronic Registration of Sales) data
->setEET(array $data): self
// Show "Already paid" in payment info
->setAlreadyPaidInPaymentInfo(bool $value): self
// Hide footer texts (generated_footer and footer_middle_text)
->setHideFooterTexts(bool $value): self
// Default: false
// Get count of displayed columns
->getDisplayedColumnsCount(): int
// Get total width of displayed columns
->getDisplayedColumnsWidth(bool $vatPayer = true): int
// Clear settings for new invoice
->clear(): self
// Set company name
->setCompany(string $company): self
// Set contact person name
->setName(string $name): self
// Set street address
->setStreet(string $street): self
// Set city
->setCity(string $city): self
// Set postal code
->setPostalCode(string $postalCode): self
// Set country
->setCountry(string $country): self
// Set company ID (IČO)
->setCompanyId(string $companyId): self
// Set tax ID (DIČ)
->setTaxId(string $taxId): self
// Set phone number
->setPhone(string $phone): self
// Set email
->setEmail(string $email): self
// Set website
->setWeb(string $web): self
// Translate labels to current language
->translate(): self
// Set order number
->setOrder(string $order): self
// Set date from
->setFromDate(string $date): self
// Set issue date
->setIssueDate(string $date): self
// Set due date
->setDueDate(string $date): self
// Set taxable supply date (date of performance)
->setTaxableSupplyDate(string $date): self
// Add custom parameter
->addParameter(string $label, string $value): self
// Translate labels to current language
->translate(): self
// Set payment method
->setPaymentMethod(string $method): self
// Set account number
->setAccountNumber(string $accountNumber): self
// Set bank code
->setBankCode(string $bankCode): self
// Set variable symbol
->setVariableSymbol(string $variableSymbol): self
// Set constant symbol
->setConstantSymbol(string $constantSymbol): self
// Set specific symbol
->setSpecificSymbol(string $specificSymbol): self
// Add custom parameter
->addParameter(string $label, string $value): self
// Translate labels to current language
->translate(): self
use Kenod\InvoiceGenerator\Iban;
// Generate IBAN from Czech account number
Iban::getIban(
string|int $account,
string|int $bankCode,
string|int $accountPrefix = '',
bool $onlyValidBic = false
): string|false
// Get BIC/SWIFT code for Czech bank
Iban::getSwift(string|int $bankCode): string
// Generate QR payment string
Iban::getQRString(array $data): string|null
// Data: ['iban' => '', 'bic' => '', 'amount' => '', 'vs' => '', 'ks' => '', 'ss' => '']
use Kenod\InvoiceGenerator\Translator;
// Load translation file, use it after calling ->setLanguage(), otherwise it won't have effect.
Translator::loadTranslations(string $filePath): void
// Translate key
Translator::t(string $key): string
// Check if language is loaded
Translator::hasLanguage(): bool
// Modify translations (overwrites existing keys, adds new ones)
Translator::modifyTranslations(array $translations): void
$invoice->settings
->setVatPayer(true)
->setReverseCharge(true, 'Reverse charge - Article 196 of Directive 2006/112/EC');
$invoice->addItem('International Services', 100, 1500, 'hours', 21);
// VAT will be 0, but rate is preserved for documentation
// Get final prices with VAT breakdown
$prices = $invoice->getFinalPrices();
echo "Total: " . $prices['total'] . " CZK\n";
if (isset($prices['vat_summary'])) {
foreach ($prices['vat_summary'] as $rate => $amounts) {
echo "VAT {$rate}%: Base=" . $amounts['base']
. ", VAT=" . $amounts['vat']
. ", Total=" . $amounts['total'] . "\n";
}
}
// Create langs/de.php
return [
'invoice' => 'Rechnung',
'supplier' => 'Lieferant',
'customer' => 'Kunde',
'total_to_pay' => 'Gesamtsumme',
// ... more translations
];
// Use in code
$invoice->settings->setLanguage('de');
$pdf = new \WFPfaktury\WFPfaktury();
$pdf->dodavatel->SetFirma('Company');
$pdf->nastaveni->SetCisloFaktury('001');
$pdf->pridejPolozku('Item', 1, 100);
$pdf->generuj();
use Kenod\InvoiceGenerator\InvoiceGenerator;
$invoice = new InvoiceGenerator();
$invoice->supplier->setCompany('Company');
$invoice->settings->setInvoiceNumber('001');
$invoice->addItem('Item', 1, 100);
$invoice->generate();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.