jitendra / breezy-pdf-lite-php
此包最新版本(1.0)没有可用的许可证信息。
breezy-pdf-lite的PHP客户端,一个由Google Chrome(breezypdf.com)驱动的HTML -> PDF服务
1.0
2018-07-08 19:03 UTC
Requires
- php: ^7.0
- rmccue/requests: ^1.7
Requires (Dev)
- phpunit/phpunit: ^6.5
- smalot/pdfparser: ^0.13.2
This package is not auto-updated.
Last update: 2024-09-24 04:07:05 UTC
README
PHP客户端,用于breezy-pdf-lite,一个由Google Chrome驱动的HTML -> PDF服务。
依赖关系
-
BreezyPDF Lite:HTML到PDF生成服务
安装
composer require jitendra/breezy-pdf-lite-php
使用示例
use BreezyPdfLite\BreezyPdfLite; $breezy = new BreezyPdfLite('https://:5000', 'VERY_RANDOM_SECRET'); // Gets pdf string for given html content $breezy->readHtml('<h1>Hello, world!</h1>') ->getPdfAsString(); // Saves converted pdf file locally for given html content $breezy->readHtml('<h1>Hello, world!</h1>') ->getPdfSavedAs('/home/ubuntu/hello.pdf'); // Saves converted pdf file locally for given local html/view file $breezy->readHtmlFromFile('/home/ubuntu/hello.html') ->getPdfSavedAs('/home/ubuntu/hello.pdf'); // Saves converted pdf file locally for given remote html page/view $breezy->readHtmlFromRemote('https://example.com') ->getPdfSavedAs('/home/ubuntu/example.pdf'); // Saves converted pdf file locally for given local html page/view // Also accepts additional print options, ref https://github.com/jitendra-1217/breezy-pdf-lite-php/blob/master/src/Options.php for all available options // Please note that these options can be provided as part of html meta tags from the html page/view itself (as in /example/2.php file) // Following options are actually appended in html content as meta tags $breezy->withOptions(['height' => 5, 'width' => 5]) ->readHtmlFromFile(__DIR__.'/input/example.html') ->getPdfSavedAs(__DIR__.'/output/example.pdf');
此外,请参考/examples/*文件夹以快速开始并尝试选项等。