Skip to content
pdfluentPublic

About

Runnable PDFluent SDK examples: text extraction, form fill, PDF/A validation, merge, redaction, compression, rendering. Rust and WebAssembly.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

PDFluent Examples

Runnable examples for the PDFluent SDK, a pure-Rust PDF SDK.

CI crates.io npm Documentation

Working code examples for the PDFluent SDK, a pure-Rust PDF SDK with XFA, PDF/A, digital signatures, and redaction, with bindings for Rust, Python, Node.js, WASM, .NET, and Java.

This repository currently has Rust examples and a browser/WASM demo. For the other languages, see the install snippets and docs linked below.

Documentation · Cookbook · Rust API reference · Changelog · Support


Quick start

git clone https://github.com/pdfluent/examples
cd examples/rust
cargo run --example text_extraction -- ../sample.pdf

Examples

Example What it shows Language How to run
text_extraction Open a PDF, extract all text, iterate page by page Rust cargo run --example text_extraction -- ../sample.pdf
form_fill Fill AcroForm text fields and checkboxes, then flatten to static PDF Rust cargo run --example form_fill -- in.pdf out.pdf
merge_pdfs Merge multiple PDFs into one with a shared bookmark structure Rust cargo run --example merge_pdfs -- a.pdf b.pdf -o merged.pdf
pdfa_validate Validate PDF/A-1b/2b/3b compliance, list violations Rust cargo run --example pdfa_validate -- ../sample.pdf
redact_text Search-based redaction: find patterns and permanently remove them Rust cargo run --example redact_text -- in.pdf out.pdf PATTERN
wasm/index.html Open a PDF and extract its text entirely in the browser via @pdfluent/sdk-wasm, no server, no upload JavaScript (WASM) Serve the repo root (python3 -m http.server), open /wasm/

How-to guide programs

The howto_* examples are the programs from the how-to guides on pdfluent.com, byte for byte; each guide page links here and embeds the video in which the same code is typed and run. Each one reads the input file named in its source, from the directory you run it in.

Example What it shows Language How to run
howto_compress_pdf Compress a PDF in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_compress_pdf
howto_encrypt_pdf Encrypt a PDF with a password in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_encrypt_pdf
howto_extract_text_by_page Extract text page by page from a PDF in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_extract_text_by_page
howto_extract_text_pdf Extract text from a PDF in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_extract_text_pdf
howto_read_pdf_metadata Read PDF metadata in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_read_pdf_metadata
howto_write_pdf_metadata Write PDF metadata in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_write_pdf_metadata
howto_generate_pdf_thumbnails Generate page thumbnails from a PDF in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_generate_pdf_thumbnails
howto_get_pdf_page_count Get the page count of a PDF in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_get_pdf_page_count
howto_merge_pdfs Merge PDFs in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_merge_pdfs
howto_render_pdf_to_jpeg Render PDF pages to JPEG images in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_render_pdf_to_jpeg
howto_render_pdf_to_png Render a PDF page to PNG in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_render_pdf_to_png
howto_open_pdf_with_password Open a password-protected PDF in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_open_pdf_with_password
howto_fill_pdf_form Fill PDF form fields in Rust, the complete program from the guide, also shown in its video Rust cargo run --example howto_fill_pdf_form

All examples run against sample.pdf, a small public test document bundled in this repo.


Installation

Add to your Cargo.toml:

[dependencies]
pdfluent = "1.0.0"

Or with specific features:

[dependencies]
pdfluent = { version = "1.0.0", features = ["signing", "pdfa", "redaction"] }

Other languages

The same engine is available outside Rust:

Language Package Docs
Python pdfluent on PyPI pdfluent.com/docs/python
Node.js @pdfluent/node on npm pdfluent.com/docs
Browser / WASM @pdfluent/sdk-wasm on npm pdfluent.com/docs/wasm
.NET pdfluent on NuGet pdfluent.com/docs/dotnet
Java com.pdfluent:pdfluent on Maven Central pdfluent.com/docs/java

Licensing

The examples in this repository are licensed under the MIT licence (see LICENSE). The PDFluent SDK they call stays under AGPL-3.0 or a commercial licence, at your option. The AGPL is the default and the complete product: there is no licence key, no activation call and no tier, every feature works in every build, and nothing marks the output. If you cannot accept the copyleft obligation, the commercial licence is sold yearly and self-service in four options: Commercial (per organisation), OEM Startup and OEM (per product), and Priority support (an add-on). Security reports go to hello@pdfluent.com.

More resources


Built by Innovation Trigger B.V. · pdfluent.com

About

Runnable PDFluent SDK examples: text extraction, form fill, PDF/A validation, merge, redaction, compression, rendering. Rust and WebAssembly.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages