定制 guillaumepotier/pdfxtractor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

guillaumepotier/pdfxtractor

Composer 安装命令:

composer require guillaumepotier/pdfxtractor

包简介

Convert PDFs to JPEG images like a charm!

README 文档

README

PdfXtractor is a PHP class that relies on GhostScript. This is a handy wrapper that allows PDF conversion to JPEG files.

Build Status

Installation

The recommended way to install PdfXtractor is through composer.

Just create a composer.json file for your project:

{
    "require": {
        "guillaumepotier/PdfXtractor": "*"
    }
}

And run these two commands to install it:

$ wget http://getcomposer.org/composer.phar
$ php composer.phar install

Now you can add the autoloader, and you will have access to the library:

<?php

require 'vendor/autoload.php';

If you don't use neither Composer nor a ClassLoader in your application, just require the provided autoloader:

<?php

require_once 'src/autoload.php';

Be sure to give permissions to the GhostScript binary you'll use:

chmod 777 bin/gs-905-osx

You're done!

Usage

You'll just need to specify the pdf you want to convert, where you want to dump the .jpg files generated and under which name:

<?php

$pdfXtractor = new PdfXtractor\PdfXtractor();
$pdfXtractor->load(__DIR__.'/file.pdf')->set(__DIR__.'/output', 'extract');
$pdfXtractor->extract();

Unit Tests

To run unit tests, set your proper phpunit.xml file by doing:

cp phpunit.xml.dist phpunit.xml
vi phpunit.xml

Set the GS_BIN you'll use in your environement. Save and launch then the following command:

phpunit

TODO

Need to better rationalize the GhostScript binary used in function of the user OS. Maybe integrate a shell script to build gs properly for the user os, because the 3 gs bin provided here are a little heavy (~100Mb) and still no better than a proper build.

Credits

Guillaume Potier. @guillaumepotier

License

PdfXtractor is released under the MIT License for the PHP Wrapper. Unfortunately, GhostScript is under GPL license. Which makes this whole project under GPL license. See the bundled LICENSE file for more details.

guillaumepotier/pdfxtractor 适用场景与选型建议

guillaumepotier/pdfxtractor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.27k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2012 年 05 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pdfxtractor」 「pdftojpeg」 「pdftojpg」 「pdfconverter」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 guillaumepotier/pdfxtractor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 guillaumepotier/pdfxtractor 我们能提供哪些服务?
定制开发 / 二次开发

基于 guillaumepotier/pdfxtractor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: GPL
  • 更新时间: 2012-05-26