itul/pdf-tools
Composer 安装命令:
composer require itul/pdf-tools
包简介
PDF Tools
关键字:
README 文档
README
A shorthand collection of methods commonly needed for pdf generation, manipulation and conversion.
Requirements
Behind the scenes this package leverages pdftotext. You can verify if the binary installed on your system by issueing this command:
which pdftotext
If it is installed it will return the path to the binary.
To install the binary you can use this command on Ubuntu or Debian:
apt-get install poppler-utils
On a mac you can install the binary using brew
brew install poppler
If you're on RedHat, CentOS, Rocky Linux or Fedora use this:
yum install poppler-utils
Installation
You can install the package via composer:
composer require itul/pdf-tools
Usage
// Usage description here
General Methods
init()
- Return type: static
- Description: Class method for initializing an instance of the class.
Modification Methods
split($path)
- Parameters:
- $path (string): The path to the PDF file.
- Return type: array
- Description: Split a PDF into individual pages.
merge(array $paths)
- Parameters:
- $paths (array): An array of paths to PDF files to merge.
- Return type: string
- Description: Merge multiple PDF files into a single PDF.
compress($path)
- Parameters:
- $path (string|array): The path to the PDF file or an array of paths.
- Return type: string|array
- Description: Compress a PDF file.
uncompress($path)
- Parameters:
- $path (string|array): The path to the compressed PDF file or an array of paths.
- Return type: string|array
- Description: Uncompress PDF data.
flatten($path)
- Parameters:
- $path (string|array): The path to the PDF file or an array of paths.
- Return type: string|array
- Description: Flatten a PDF to make text not selectable.
stamp($path, string $stampPath, $allPages = false)
- Parameters:
- $path (string|array): The path to the PDF file or an array of paths.
- $stampPath (string): The path to the PDF file to use as a stamp.
- $allPages (bool): Whether to stamp all pages of the PDF.
- Return type: string|array
- Description: Stamp a PDF with another PDF.
fill(string $path, array $data = [])
- Parameters:
- $path (string): The path to the PDF file.
- $data (array): An associative array containing form field data.
- Return type: string
- Description: Fill PDF form fields with data.
Data Methods
pdfInfo(string $path)
- Parameters:
- $path (string): The path to the PDF file.
- Return type: \GeneralObject
- Description: Get PDF information.
pageCount(string $path)
- Parameters:
- $path (string): The path to the PDF file.
- Return type: float
- Description: Get the number of pages in a PDF.
Conversion Methods
toPdf($path)
- Parameters:
- $path (string|array): The path to the file or an array of file paths.
- Return type: string|array
- Description: Convert a file to a PDF.
toImage(string $path, $format = 'png', $density = 300)
- Parameters:
- $path (string): The path to the file.
- $format (string): The image format to convert to (default is 'png').
- $density (int): The density for the image conversion (default is 300).
- Return type: array
- Description: Convert a file to an image.
HTML Rendering Methods
fromHTML(string $html)
- Parameters:
- $html (string): The HTML content or file path.
- Return type: string
- Description: Convert an HTML file or a string of HTML to a PDF.
fromView($view, $data = [])
- Parameters:
- $view (string): The name of the view.
- $data (array): The data to pass to the view.
- Return type: string
- Description: Render a Laravel view as a PDF.
toHTML($path, $raster = false, $gen = true)
- Parameters:
- $path (string): The path to the fillable PDF.
- $raster (bool): Whether to rasterize the PDF.
- $gen (bool): Whether to generate the parsed HTML.
- Return type: mixed
- Description: Convert a fillable PDF to an HTML form.
fillableFromHtml(string $pageHtml, string $pageStyle = null)
- Parameters:
- $pageHtml (string): The HTML content or file path.
- $pageStyle (string|null): The CSS style content or file path.
- Return type: string
- Description: Convert a single HTML page to a fillable PDF form.
OCR Methods
toSearchablePdf($files)
- Parameters:
- $files (string|array): The file path or an array of file paths.
- Return type: string|array
- Description: Convert one or more files to a searchable PDF.
asText($path)
- Parameters:
- $path (string|array): The path to the PDF file or an array of PDF file paths.
- Return type: \Illuminate\Support\Collection
- Description: Extract text from a PDF.
isSearchable($path)
- Parameters:
- $path (string): The path to the PDF file.
- Return type: bool
- Description: Check if the PDF is searchable.
itul/pdf-tools 适用场景与选型建议
itul/pdf-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.44k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 06 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「itul」 「pdf-tools」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 itul/pdf-tools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 itul/pdf-tools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 itul/pdf-tools 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simpler way write custom laravel validation messages
Dynamically link models together without changing the database
Laravel migration fields for things like address and name
The best way to connect to quickbooks desktop from laravel
A laravel model for running and recording api transactions
Class for working with quickbooks desktop xml
统计信息
- 总下载量: 1.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-02