pdfkiwi/php-lib
Composer 安装命令:
composer require pdfkiwi/php-lib
包简介
A PHP library for interacting with pdf.kiwi API
README 文档
README
A PHP library for interacting with pdf.kiwi API
Installation
$ composer require "pdfkiwi/php-lib"
Then, don't forget to use the PdfKiwi namespace in your own classes before using it:
<?php use PdfKiwi\PdfKiwi;
Quick start guide
When instanciating the Pdfkiwi class, we must give it the email address and the API key (token)
to be able to connect the API with our account's credentials.
Here is an exemple:
<?php use PdfKiwi\PdfKiwi; $pdfKiwi = new PdfKiwi($email, $token);
Then we can set some options, this way:
<?php $pdfKiwi->setPageMargins('10mm', '20mm', '10mm', '20mm'); $pdfKiwi->setOrientation('landscape');
Finally, once we have defined all our options, we can fire the method convertHtml() which returns
the converted PDF:
<?php $pdf = $pdfKiwi->convertHtml($html);
Public methods list
setPageWidth()
To set the page width.
Parameter:
$value (string) The document's page width, with unit (eg. '210mm')
setPageHeight()
To set the page height.
Parameter:
$value (string) The document's page height, with unit (eg. '297mm')
setHeaderHtml()
To set page header using HTML format.
Parameter:
$value (string) The HTML content of the header
setHeaderSpacing()
To set the space between the header and the document's body.
Parameter:
$value (float) The space (in mm) between the header and the body, without unit
setHeaderText()
To set page headers using TEXT format.
Parameters:
$value (mixed) Can be either :
- (string) The (text) content of the header (will be left aligned)
- (array) An array with 3 values of text, respectively : [left, center, right]
setFooterHtml()
To set page footer using HTML format.
Parameter:
$value (string) The HTML content of the footer
setFooterSpacing()
To set the space between the footer and the document's body.
Parameter:
$value (float) The space (in mm) between the footer and the body, without unit
setFooterText()
To set page footers using TEXT format.
Parameters:
$value (mixed) Can be either :
- (string) The (text) content of the footer (will be left aligned)
- (array) An array with 3 values of text, respectively : [left, center, right]
setHeaderFooterPageExcludeList()
To set a list of pages numbers on which the header and footer won't be printed.
Parameter:
$value (mixed) Can be either :
- (string) A comma separated list of page numbers (without space, eg. '1,3,5')
- (array) An array with a list of page numbers (eg. [1, 3, 5])
setPageMargins()
To set document's pages margins.
Parameters:
$top (string) Top margin value, with unit (eg. '20mm')
$right (string) Right margin value, with unit (eg. '20mm')
$bottom (string) Bottom margin value, with unit (eg. '20mm')
$left (string) Left margin value, with unit (eg. '20mm')
setOrientation()
To set page's orientation.
Parameter:
$orientation (string) The page's orientation. Can be either 'landscape', or 'portrait'.
pdfkiwi/php-lib 适用场景与选型建议
pdfkiwi/php-lib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.76k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 05 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pdfkiwi/php-lib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pdfkiwi/php-lib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9.76k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-31