tallieutallieu / dry-pdfgen
此包最新版本(1.0.1)没有可用的许可信息。
使用 Dompdf 生成 PDF
1.0.1
2021-03-23 15:37 UTC
Requires
- dompdf/dompdf: ^0.8.3
- tallieutallieu/oak: ^1.0.8
This package is auto-updated.
Last update: 2024-09-16 14:09:54 UTC
README
从 HTML 标记生成 PDF 文档
dry-pdfgen 在后台使用 Dompdf。有关 Dompdf 的更多信息,请查看其 Github 仓库:https://github.com/dompdf/dompdf
安装
composer require tallieutallieu/dry-pdfgen
注册服务提供者
<?php $app = new \Oak\Application(); $app->register([ \Tnt\PdfGen\PdfGenServiceProvider::class, ]); $app->bootstrap();
基本用法
<?php $pdfGenerator = $app->get(PdfGenerator::class); $pdfGenerator->fromHtml('<strong>This is an example</strong>'); // Stream the pdf $pdfGenerator->stream(); // or... // ...use the pdf file contents $contents = $pdfGenerator->output();