PdfService
in package
PDF generation service Handles PDF document generation using DomPDF library for various formats including standard A4 documents and thermal printer receipts
Table of Contents
Properties
- $domPdf : Dompdf
Methods
- __construct() : mixed
- Constructor Initializes DomPDF with default configuration options
- generateBinaryPdf() : void
- Generate and stream PDF directly to browser
- generatePdfFile() : Response
- Generate a PDF file as HTTP response for download
- generateThermalPdfFile() : Response
- Generate PDF file optimized for thermal printers (80mm width)
Properties
$domPdf
private
Dompdf
$domPdf
DomPDF instance for PDF generation
Methods
__construct()
Constructor Initializes DomPDF with default configuration options
public
__construct() : mixed
generateBinaryPdf()
Generate and stream PDF directly to browser
public
generateBinaryPdf(string $html, string $filename) : void
Parameters
- $html : string
-
HTML content to convert to PDF
- $filename : string
-
Filename for the PDF (not used in stream)
generatePdfFile()
Generate a PDF file as HTTP response for download
public
generatePdfFile(string $html, string $filename) : Response
Parameters
- $html : string
-
HTML content to convert to PDF
- $filename : string
-
Filename for the PDF download
Return values
Response —HTTP response with PDF attachment
generateThermalPdfFile()
Generate PDF file optimized for thermal printers (80mm width)
public
generateThermalPdfFile(string $html, string $filename) : Response
Parameters
- $html : string
- $filename : string