https://github.com/benconda/php-pdfium
Pdfium library implementation in PHP using FFI
https://github.com/benconda/php-pdfium
library pdf pdf-viewer pdfium php
Last synced: 6 months ago
JSON representation
Pdfium library implementation in PHP using FFI
- Host: GitHub
- URL: https://github.com/benconda/php-pdfium
- Owner: benconda
- Created: 2024-01-27T15:12:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-21T16:47:38.000Z (about 1 year ago)
- Last Synced: 2025-07-22T20:02:49.966Z (11 months ago)
- Topics: library, pdf, pdf-viewer, pdfium, php
- Language: C
- Homepage:
- Size: 2.87 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://packagist.org/packages/benconda/php-pdfium)
# 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