定制 benconda/php-pdfium 二次开发

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

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

benconda/php-pdfium

最新稳定版本:0.0.2

Composer 安装命令:

composer require benconda/php-pdfium

包简介

PHP implementation of PDFium C++ library

README 文档

README

Packagist Version

Experimental

This is a first attempt to implement PDFium in PHP using FFI. Pdfium is a C++ library supported by Google team to render, manipulate and extract data from PDF.

Contribution are welcome.

Currently working

On PDF Document :

  • Getting page count
  • Iterate through Document pages

On each Page :

  • Get pages size in point
  • Render a page into a .png
  • Iterate through page annotations
  • Iterate through page fields

On each Annotation :

  • Get the annotation type (enum) and index

On each FormField :

  • Get the type (enum), value, name, alternateName, exportValue, formControlCount, formControlIndex, isChecked (for checkbox and radiobutton)

About page rendering, this only works thanks to libvips integration, it's the only way to get a fast rendering

Feel free to look in the tests to know how it works.

Remaining works

There is still a lot of work to do, could be great to have the ability to edit PDF files. At least for adding forms fields on page, and fill them.

Development

Here is the Google pdfium repository https://pdfium.googlesource.com/pdfium/+/refs/heads/main there is some tests and C samples inside.

The public directory contains the headers, that we have access in this repository docker image (take a look at the Dockerfile)

Note : We use pre-compiled libraries for pdfium and libvips for simplicity.

On Docker image build, libraries headers are available in /usr/lib-pdfium and /usr/lib-vips directories

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: C

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-21