armonia-tech / armonia-pdf
Wrapper for 3rd party pdf renderer
Installs: 4 449
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- dompdf/dompdf: 0.8.5
- phenx/php-font-lib: 0.5.2
This package is auto-updated.
Last update: 2025-03-16 09:23:14 UTC
README
A library to convert html to pdf
Add to Project
In your project's directory run in cli:
composer require armonia-tech/armonia-pdf:dev-master
Development
Go up 1 level from your project's directory, run in cli:
git clone https://github.com/armonia-tech/armonia-pdf.git
In your project's composer.json, add the following:
"repositories": [ { "type": "path", "url": "../armonia-pdf" } ]
then run in cli:
composer require armonia-tech/armonia-pdf:dev-master
Usage
Basic:
use ArmoniaPDF\PDF; $dompdf = new PDF; $dompdf->setPaper('A4', 'portrait'); $dompdf->loadHtml('<div>Hello</div>'); $dompdf->stream('download.pdf');
Methods:
Methods | Arguments | Return | Description |
---|---|---|---|
__construct($options) |
Dompdf\Options $options |
void |
Initialize pdf instance with options, refer to dompdf/dompdf for available options |
loadHtml($html) |
string $html |
void |
Insert the html content into pdf |
setTitle($title) |
string $title |
void |
Set the title of pdf when downloading |
addStyleSheet($stylesheet) |
string $stylesheet |
void |
append stylesheet into the pdf |
outputHtml() |
none |
string |
Return the html generated by dom pdf |
setPaper($size) |
string $size = 'A4' , string $orientation = 'portrait' |
void |
Set the paper size and orientation |
stream($file_name, $options) |
string $file_name, $options |
stream |
Start downloading the pdf |