PHPackages                             razvan171514/pdf-gen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. razvan171514/pdf-gen

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

razvan171514/pdf-gen
====================

A laravel package for pdf generation.

1.0.0(6y ago)03[4 PRs](https://github.com/razvan171514/pdf-gen/pulls)MITPHP

Since Apr 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/razvan171514/pdf-gen)[ Packagist](https://packagist.org/packages/razvan171514/pdf-gen)[ RSS](/packages/razvan171514-pdf-gen/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (6)Used By (0)

**pdf-gen**
===========

[](#pdf-gen)

A laravel package for pdf generation
------------------------------------

[](#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

```
$ composer require razvan171514/pdf-gen
```

**Installation**
----------------

[](#installation)

### Laravel 7.x

[](#laravel-7x)

In the `config/app.php` file an alias can be added for ease of use when importing the facade.

```
...
'aliases' => [
    ...
    'Pdf' => razvan\PdfGen\Pdf::class,
    ...
],
...
```

**Publishing configuration**
----------------------------

[](#publishing-configuration)

The defaults configuration settings are set in `config/pdf.php` . Copy this file to your own config directory to modify the values. You can publish the config using this command:

```
$ php artisan vendor:publish --provider="razvan\PdfGen\PdfServiceProvider"
```

The configuration file contains the options for the setting of this package such as driver configuration and configuration for specific drivers (ex. dompdf).

```
return [
    /** mpdf , dompdf*/
    'driver' => 'dompdf',
    'dompdf_config' => [
        'page' => 'A4',
        /** landscape, portrait */
        'orientation' => 'portrait',
    ],
    /** path to template directoy */
    'templates_path' => __DIR__ . '/../resources/views/',
    /** path to output directory */
    'output_path' => __DIR__ . '/../resources/views/pdfs/',
];
```

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](https://laravel.com/docs/7.x/helpers#method-base-path) helper can be used

```
...
'templates_path' => base_path('resources/views'),
'output_path' => base_path('resources/views/pdfs'),
...
```

> **Note:** The output folder has to exist otherwose an exception will be thrown

**Usage**
---------

[](#usage)

The havy lifting of the entire package is done by the `razvan\PdfGen\Pdf::class` witch is resolving the configuration in the `config/pdf.php` file and returns the desired pdf file.

```
Pdf::generate('file_name.html', [
    'name' => 'oputput_file_name.pdf',
    'mode' => 'F',
]);
```

The `razvan\PdfGen\Pdf::generate()` method accepts tow arguments:

1. The template file (the supported types are html, markdown, view).
2. 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 `file.pdf` and the mode key to `F`

Modes:

- **`F`** for saving the pdf file in the project folder at the specified path in the configuration.
- **`D`** for downloading the pdf file.

> **Note:** For the dompdf driver only the `D` mode is ***not*** available

Examples:

```
...
use razvan\PdfGen\Pdf;
...
// html template
Pdf::generate('file_name.html', ['name' => 'some_other_name.pdf']);
// markdown template
Pdf::generate('file_name.md', ['mode' => 'D']);
// view
Pdf::generate(view('blade_view'));
// view with data
Pdf::generate(view('blade_view', compact('data')), [
    'name' => 'cool_name.pdf',
    'mode' => 'D',
]);
```

> **Note:** The import statement can be changed with only `use Pdf;` if the alias is added to `config/app.php` 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)

**License**
-----------

[](#license)

### [razvan171514/pdf-gen](https://github.com/razvan171514/pdf-gen) is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT)

[](#razvan171514pdf-gen-is-open-sourced-software-licensed-under-the-mit-license)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2203d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ecf379f58fc6e83dcd371ee93bd474f644298cf516966d52ab5ba7fcd8c090ff?d=identicon)[razvan171514](/maintainers/razvan171514)

---

Top Contributors

[![rbolundut](https://avatars.githubusercontent.com/u/28761971?v=4)](https://github.com/rbolundut "rbolundut (4 commits)")

### Embed Badge

![Health badge](/badges/razvan171514-pdf-gen/health.svg)

```
[![Health](https://phpackages.com/badges/razvan171514-pdf-gen/health.svg)](https://phpackages.com/packages/razvan171514-pdf-gen)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[carlos-meneses/laravel-mpdf

Laravel Mpdf: Using Mpdf in Laravel to generate Pdfs.

4403.1M7](/packages/carlos-meneses-laravel-mpdf)[kartik-v/yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.

1605.5M84](/packages/kartik-v-yii2-mpdf)[consoletvs/invoices

Generate PDF invoices for your customers in laravel

455275.5k](/packages/consoletvs-invoices)[nucleos/dompdf-bundle

This bundle provides a wrapper for using dompdf inside symfony.

54882.8k1](/packages/nucleos-dompdf-bundle)[contributte/pdf

Pdf response extension for Nette Framework

43967.8k2](/packages/contributte-pdf)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
