violet88/silverstripe-dompdf
Composer 安装命令:
composer require violet88/silverstripe-dompdf
包简介
SilverStripe PDF Generation via DOMPDF Library
README 文档
README
This is a fork of https://github.com/burnbright/silverstripe-dompdf for use with Composer.
Maintainer: Jeremy Shipman (jeremy@burnbright.net)
Makes use of: https://github.com/dompdf/dompdf Dompdf websites: http://dompdf.github.com/, http://pxd.me/dompdf/www/
Input:
- HTML string (which could be rendered template)
- HTML File
Output
- PDF File location
- SS File
- PDF binary stream to browser
Installation
###Composer
- On the command line, cd into your sites root folder
- Run
composer require gdmedia/silverstripe-dompdf - Run dev/build?flush=all in your browser
###Manually
- Download the module from https://github.com/guru-digital/silverstripe-dompdf/archive/master.zip
- Extract the files into your silverstripe root folder
- Run dev/build?flush=all in your browser
Example usage
$pdf = new SS_DOMPDF(); $pdf->setHTML($mydataobject->renderWith('MyTemplate')); $pdf->render(); $pdf->toFile('mypdf.pdf');
Debugging
The $pdf->streamdebug(); function is useful for quickly viewing pdfs, particularly if your browser supports displaying pdfs, rather than downloading.
You can check your html before it is converted like this:
echo $mydataobject->renderWith('MyTemplate');die();
Useful Tips
- Use tables for layout if you get errors from floating divs.
- See the official dompdf website for more info
统计信息
- 总下载量: 74
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-08-01