putuariepra/php-pdfstamper
Composer 安装命令:
composer require putuariepra/php-pdfstamper
包简介
Add an image to PDF's pages
README 文档
README
This package using crossref/pdfstamp
| Function | Params | Description |
|---|---|---|
| render() | To process adding an image to PDF's pages and get the output | |
| setStampUrl(url) | url: string | Add url redirection to the image |
| setDpi(dpi) | dpi: numeric | Set image's DPI. Default DPI is 300 |
| setLocation(x,y) | x: numeric y: numeric |
Set coordinate location of image in page. Default (x,y): 0,0 |
| setPage(page) | page: numeric or array (e.g: [1,4,5]) | Set pages to add image. Multiple pages are allowed. Default: page 1 |
| setPageRange(range) | range: array [start,end] (e.g: [[1,3], [5,7]]) |
Set pages in range to add image. Multiple pages are allowed. Default: page 1 |
| overwrite() | Overwrite the stamped image if already exists. Default: false | |
| disableValidation() | Disable validation of PDF file (exists and must be pdf), image (exists and must be image format) and output directory (writeable) |
Examples
Standard usage
use PdfStamper\PdfStamper;
PdfStamper::stamp(
'/dir/targetfile.pdf',
'/dir/image.jpg'
)
->setLocation(40,40)
->overwrite()
->render();
Determine output directory
use PdfStamper\PdfStamper;
PdfStamper::stamp(
'/dir/targetfile.pdf',
'/dir/image.jpg',
'/dir/output'
)
->setLocation(40,40)
->overwrite()
->render();
Set a page (e.g: page number 2)
use PdfStamper\PdfStamper;
PdfStamper::stamp(
'/dir/targetfile.pdf',
'/dir/image.jpg'
)
->setLocation(40,40)
->overwrite()
->setPage(2)
->render();
Set pages (e.g: pages 1, 3, and 4)
use PdfStamper\PdfStamper;
PdfStamper::stamp(
'/dir/targetfile.pdf',
'/dir/image.jpg'
)
->setLocation(40,40)
->overwrite()
->setPage([1,3,4])
->render();
Set pages using range (e.g: pages 1-3 and 6-8)
use PdfStamper\PdfStamper;
PdfStamper::stamp(
'/dir/targetfile.pdf',
'/dir/image.jpg'
)
->setLocation(40,40)
->overwrite()
->setPageRange([
[1,3],
[6,8]
])
->render();
Requirements
- PHP: >=5.6.0
- JRE
Installation
This package can be installed either in native PHP or Framework such Laravel
Run composer require to install
composer require putuariepra/php-pdfstamper
Credit
putuariepra/php-pdfstamper 适用场景与选型建议
putuariepra/php-pdfstamper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 438 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 08 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 putuariepra/php-pdfstamper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 putuariepra/php-pdfstamper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 438
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-08-03