Expand description
§PDFluent — Pure-Rust PDF SDK
pdfluent is the public API for the PDFluent SDK. It provides a single,
coherent entry point for PDF manipulation: loading, editing, rendering,
merging, signing, encryption, redaction, PDF/A compliance, and more.
§Quick start
use pdfluent::prelude::*;
fn main() -> Result<()> {
let mut doc = PdfDocument::open("invoice.pdf")?;
doc.metadata_mut()
.set_title("Processed Invoice")
.commit()?;
{
let mut form = doc.form_mut();
form.set_text("invoice_number", "INV-2026-0042")?
.set_checkbox("paid", true)?;
}
doc.compress(CompressOptions::strict())?;
doc.save("invoice-processed.pdf")?;
Ok(())
}§Licensing
There is no licence key, no tier and no activation call. PDFluent is
published under the AGPLv3 with a commercial licence as the alternative,
and a commercial licensee’s rights come from a signed order form rather
than from a check in the binary. Nothing here reads a key, refuses a
capability or marks output. See docs/licensing.md.
§Design foundation
The public API is frozen per RFC 0001 (see docs/rfc/0001-sdk-core-api.md).
Breaking changes require a new RFC.
Re-exports§
pub use crate::compliance::PdfAProfile;pub use crate::compliance::PdfAValidationReport;pub use crate::compliance::Violation;pub use crate::decoration::PageDecoration;pub use crate::diagnostics::Diagnostic;pub use crate::diagnostics::DiagnosticCategory;pub use crate::diagnostics::LeniencyReport;pub use crate::diagnostics::Severity;pub use crate::document::OpenOptions;pub use crate::document::Page;pub use crate::document::Pages;pub use crate::document::PdfDocument;pub use crate::document::PdfVersion;pub use crate::document::SaveOptions;pub use crate::document::TextBlock;pub use crate::encrypt::EncryptOptions;pub use crate::encrypt::EncryptionAlgorithm;pub use crate::encrypt::Permissions;pub use crate::error::Error;pub use crate::error::ResourceLimitKind;pub use crate::error::Result;pub use crate::form::FieldType;pub use crate::form::FormField;pub use crate::form::PdfFormMut;pub use crate::images::DecodedImage;pub use crate::images::ExtractedImage;pub use crate::images::ImageColorSpace;pub use crate::images::ImageId;pub use crate::images::ImageInfo;pub use crate::merger::BookmarkMergeStrategy;pub use crate::merger::MergeOptions;pub use crate::merger::PdfMerger;pub use crate::metadata::Metadata;pub use crate::metadata::MetadataMut;pub use crate::parity::CompressOptions;pub use crate::parity::CompressReport;pub use crate::parity::FontSubsetReport;pub use crate::parity::ImageFormat;pub use crate::parity::ImageInsert;pub use crate::parity::ImageInsertReport;pub use crate::parity::InsertImageFormat;pub use crate::parity::RenderPageOptions;pub use crate::parity::ToImagesOptions;pub use crate::parity::ToImagesReport;pub use crate::redact::RedactOptions;pub use crate::signer::PadesProfile;pub use crate::signer::PdfSigner;pub use crate::signer::Pkcs12Signer;pub use crate::signer::SignOptions;pub use crate::signer::SignatureInfo;pub use crate::signer::SignatureStatus;pub use crate::signer::SignatureValidation;pub use crate::signer::SignatureValidationReport;pub use crate::watermark::Layer;pub use crate::watermark::Position;pub use crate::watermark::Rotation;pub use crate::watermark::WatermarkOptions;pub use crate::xfa::XfaCommitReport;pub use crate::xfa::XfaField;pub use crate::xfa::XfaFieldOption;pub use crate::xfa::XfaFieldType;pub use crate::xfa::XfaFieldValue;pub use crate::xfa::XfaFormModel;pub use crate::xfa::XfaPresenceChange;pub use crate::xfa::XfaRect;pub use crate::xfa::XfaSetOutcome;pub use crate::xfa::XfaWidget;
Modules§
- annotation
- Annotation types.
- async_
io async-tokio - Async I/O wrappers built on Tokio.
- compat
- A second, compatible spelling of the document API, built on the facade.
- compliance
- PDF/A compliance types.
- decoration
- Unified page-decoration surface (Epic 3 #1225).
- diagnostics
- Public diagnostics model.
- document
PdfDocumentand lifecycle types.- encrypt
- Encryption, decryption, and permissions.
- error
- Error types for
pdfluent. - form
- Form field reading and mutation.
- image_
edit - Image placements already on a page: list, move or resize, replace, remove.
See
PdfDocument::image_placements. Edit images that are already placed on a page: list them, move or resize one, swap its picture, remove it. - images
- Embedded-image extraction on the plain facade.
- merger
PdfMerger— factory builder for merging multiple PDF documents.- metadata
- Document metadata (Info dict + XMP).
- model
- The model tiers’ shared surface, re-exported from
pdf-engine: the model specs, the failure types and the install paths (#641). - ocr
- Optical character recognition.
- parity
- Options and reports for Epic 3 #1224 parity methods.
- pdfa
- PDF/A profiles and validation reports — an alias for
compliance. - prelude
- Convenient re-exports for common
pdfluentusage. - redact
- Redaction options.
- signer
- Digital signature types.
- structure
- Document-structure read APIs: outlines, annotations, attachments.
- tagged
pdfa - Reading the logical structure tree of a tagged PDF (ISO 32000-1 §14.7).
- text_
edit - Async I/O wrappers via Tokio’s blocking pool. Layout-aware text replacement engine (find & replace by match id). Layout-aware text editing: find → stage → commit (Phase 1B engine).
- unicode_
font font-subset - Embedding a caller-supplied Unicode font, so a replacement can contain
scripts the document itself never had. See
text_edit::FontFallback::EmbedUnicode. Embedding a caller-supplied Unicode font, so a replacement can contain characters the document’s own fonts have no glyph for. Embedding a caller-supplied Unicode font as a Type0 composite font, so a replacement can contain characters the original font has no glyph for. - watermark
- Watermarking options.
- xfa
- XFA form field model — public DTOs for the Phase-1 XFA fill API.
Structs§
- Block
- The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Docling
Page - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Extract
Options - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Markdown
Options - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Processing
Limits - Re-export of
pdf_engine::ProcessingLimitsfor use withOpenOptions::with_processing_limits. Resource limits for a single PDF processing operation. - Tatr
Options - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Word
- The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573).
Enums§
- Block
Kind - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - OcrMode
- The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Options
Error - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Page
Separators - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Quality
- The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - Raster
Quality - Rasterization precision/speed trade-off for render paths, re-exported from the engine (one definition, not a facade copy, so callers holding a value from either crate hold the same type). Rasterization precision / speed trade-off for the vello_cpu pipeline.
Functions§
- api_
version - The SDK version at compile time. Bindings check this at runtime to ensure
compatibility with the loaded
pdfluentdynamic library. - join_
page_ texts - Re-export of
pdf_engine::join_page_texts: the form-feed convention every PDF text reader emits, for callers that hold the pages fromPdfDocument::extract_text_pagesand want the flat form of them. Join per-page text the waypdftotextandmutoolhave for twenty years: a form feed (U+000C) after every page, preceded by a blank line so the last paragraph of a page is not glued to the separator. - to_
docling_ json - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - to_json
- The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - to_
json_ with_ words - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - to_
markdown - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - to_
markdown_ with_ code - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - to_
markdown_ with_ options - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573). - to_
words_ json_ lines - The block model and both serialisations of it, re-exported from
pdf-engine: whatPdfDocument::extract_blockshands back, which pages it hands back, and the two ways to write them out (#573).