ambersive/pdfprinter

This package for laravel provides a simple way to create pdf documents. This packages requires a running instance of the PRINT-API (also open sourced).
2,633 16
Install
composer require ambersive/pdfprinter
Latest Version:v0.4.3
License:MIT
Last Updated:Jan 14, 2025
Links: GitHub  ·  Packagist
Maintainer: sushidev

PDF Printer

Maintainability Build Status

This package is a wrapper for the PRINT-API from AMBERSIVE KG. This package requires this endpoint otherwise you will not be able to create any pdf document.

Installation

composer require ambersive/pdfprinter

Usage

Please be aware that you will need a running instance of the PRINT-API. Otherwise the methods won't work as expected.

// Setup the pdf printer
$printer  = new PdfPrinter($settings);
$printer->create("http://localhost:8080/pdf")->save("folder");

The full possiblities

// Setup the pdf printer
$settings = new PdfPrinterSetting("http://localhost", 3000);
$printer  = new PdfPrinter($settings);
$options  = new PdfPrinterOption(
    $filename, 
    $postBackUrl,
    [], //$postBackBody 
    "" // $token
);

// Set auth header for basic authentication
$username = "test";
$password = "asdf";
$printer->authBasic($username, $password);

// Set auth header for basic authentication
$printer->authBearer("CUSTOM OR JWT TOKEN");

$printer->create("http://127.0.0.1:8000", null, function($instance, $result, $options, $successful) {
    // Will be executed after print execution
})->save('test', null, function($instance, $result, $filename, $path, $successful){
    // Do stuff after storing (even called if store was not successful)
});

How to create beautiful documents

While this package is a connection between the print server and your laravel application (so it's a helper method), we also created a package document-viewer which will help you to create printable documents. The document viewer will help you to define the required routes for getting and uploading the files. And it will even give you a smooth way to delare "Printables".

Security Vulnerabilities

If you discover a security vulnerability within this package, please send an e-mail to Manuel Pirker-Ihl via manuel.pirker-ihl@ambersive.com. All security vulnerabilities will be promptly addressed.

License

This package is open-sourced software licensed under the MIT license.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

637,827,751 9,703
laravel/framework

The Laravel Framework.

589,172,971 34,950
laravel/tinker

Powerful REPL for the Laravel framework.

498,216,183 7,442
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

413,412,504 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

394,964,158 4,660

Version History

Version Released Laravel License
v0.4.3 6.*|7.*|8.* MIT
v0.4.2 6.*|7.*|8.* MIT
v0.4.1 6.*|7.*|8.* MIT
v0.4.0 6.*|7.*|8.* MIT
v0.3.5 6.*|7.*|8.* MIT