Download the PHP package drewlabs/php-dompdf without Composer
On this page you can find all versions of the php package drewlabs/php-dompdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-dompdf
Library Documentation
This library is build on top of [https://github.com/dompdf/dompdf] PHP library for converting html document to PDF. It provides users with API for reading document from file path, psr7 stream object or even PHP SplFileInfo class. It also provides developpers with a response object that inherit from symfony HTTP response object for returns PDF as response.
Installation
The library is build with composer requirements in mind and requires composer
package manager for installation. To install the library to your PHP project:
composer require drewlabs/php-dompdf
Usage
To create a PDF instance, use the proxy function provides by the package:
The package provides a factory class for creating DOMPdf instances. For Object Oriented enthousiast, creating a dom-pdf instance is simply as:
- Reading DOM string
The Dompdf
provides developper with various method for loading DOM string from system path, SplFileInfo
instance, psr7 compatible stream object or inline string.
-- Generic method
For all mentionned above types, the library provide a single method for reading dom string:
Aside the generic method Domdfp::read
, the library provides a 2 additional method for reading raw string or url resource.
Utility methods
- Set pdf orientation
setPaperOrientation($size, $orientation)
is the API provided to modify the paper size and orientation.
size : Drewlabs\Dompdf\Size::LETTER, Drewlabs\Dompdf\Size::LEGAL, Drewlabs\Dompdf\Size::A4 orientation : Drewlabs\Dompdf\Orientation::LANDSCAPE, Drewlabs\Dompdf\Orientation::PORTRAIT
- Print PDF content
The library provides developper with a method to return the generated PDF string through the Dompdf::print
API. To print a raw document:
- Http response
The Dompdf::download(string $name)
API allows developper to create a response object from the PDF content.
- Streaming content
The library provides developper with method to streaming pdf content to request client.
All versions of php-dompdf with dependencies
dompdf/dompdf Version ^1.0.2|^2.0.1
symfony/http-foundation Version ^5.1.5
nyholm/psr7 Version ^1.5