Download the PHP package razvan171514/pdf-gen without Composer
On this page you can find all versions of the php package razvan171514/pdf-gen. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download razvan171514/pdf-gen
More information about razvan171514/pdf-gen
Files in razvan171514/pdf-gen
Package pdf-gen
Short Description A laravel package for pdf generation.
License MIT
Informations about the package pdf-gen
pdf-gen
A laravel package for pdf generation
Require this package in your composer.json and update composer. This will download the package and the folowing libraries also:
- mpdf/mpdf
- erusev/parsedown
- dompdf/dompdf
Installation
Laravel 7.x
In the file an alias can be added for ease of use when importing the facade.
Publishing configuration
The defaults configuration settings are set in . Copy this file to your own config directory to modify the values. You can publish the config using this command:
The configuration file contains the options for the setting of this package such as driver configuration and configuration for specific drivers (ex. dompdf).
Here is allso configured the path to the templates directory and the path where the generated pdfs will be stored. Insted of the default hardcoded path the base_path helper can be used
Note: The output folder has to exist otherwose an exception will be thrown
Usage
The havy lifting of the entire package is done by the witch is resolving the configuration in the file and returns the desired pdf file.
The method accepts tow arguments:
- The template file (the supported types are html, markdown, view).
- An array with tow elements: name and mode. The name key holds the output file name and the mode key holds the action that will be performed.
Note: The second argument is optional and if it's not present the name key will default to and the mode key to
Modes:
- **** for saving the pdf file in the project folder at the specified path in the configuration.
- **** for downloading the pdf file.
Note: For the dompdf driver only the mode is not available
Examples:
Note: The import statement can be changed with only if the alias is added to file
Note: The second argument accepted by the generate method can be passed with only one of the two keys (the other one will defaulted with it's default value)