Expand description
PDF editing and writing for rpdfium — a faithful Rust port of PDFium.
This crate implements PDF editing capabilities:
- Object serialization: PDF objects → byte output
- Stream encoding: Flate compression for output streams
- EditDocument: Mutable overlay on top of immutable ObjectStore
- PDF writing: Full rewrite and incremental save
- Page management: Add, delete, move pages; insert page objects
- Content generation: Paths, text, images → content stream operators
- Annotation editing: Create, modify, delete annotations
- Form persistence: Update form field values
- Encryption output: Re-encrypt modified documents
§Design
The core pattern is a mutable overlay (EditDocument) that layers
modifications on top of an existing immutable ObjectStore. This
preserves the read-only design of the parser while enabling editing.
Re-exports§
pub use cpdf_creator::WriteOptions;pub use cpdf_creator::write_full;pub use cpdf_npagetooneexporter::NupPageSettings;pub use cpdf_npagetooneexporter::export_npage_to_one;pub use cpdf_pageexporter::export_pages;pub use cpdf_pageexporter::export_pages_from_range;pub use document::EditDocument;pub use document::FormFieldSpec;pub use error::EditError;pub use error::EditResult;pub use font_reg::FontRegistration;pub use font_reg::FontType;pub use font_reg::GlyphPath;pub use font_reg::GlyphSegment;pub use font_reg::GlyphSegmentType;pub use fpdf_annot::AnnotationBuilder;pub use fpdf_annot::AnnotationSpec;pub use fpdf_annot::AnnotationUpdates;pub use fpdf_ppo::parse_page_range;pub use object_ctx::AnnotObjectCtx;pub use object_ctx::AnnotObjectCtxMut;pub use object_ctx::PageObjectCtx;pub use object_ctx::PageObjectCtxMut;pub use page_object::ClipPath;pub use page_object::ContentMark;pub use page_object::FillMode;pub use page_object::FormObject;pub use page_object::ImageMetadata;pub use page_object::ImageObject;pub use page_object::MarkParamValue;pub use page_object::PageObject;pub use page_object::PathObject;pub use page_object::PathSegment;pub use page_object::TextObject;pub use page_object::parse_jpeg_dimensions;pub use page_object::path_ops_to_segments;pub use page_object::segments_to_path_ops;
Modules§
- cpdf_
creator - PDF Writer — full rewrite of a document to PDF bytes.
- cpdf_
flateencoder - Stream encoding utilities for PDF output.
- cpdf_
npagetooneexporter - N-up page export — arrange multiple source pages in a grid on fewer dest pages.
- cpdf_
pagecontentgenerator - Content stream generation — converts PageObjects to PDF content stream bytes.
- cpdf_
pageexporter - Page export — deep-clone pages from one document into another.
- document
- EditDocument — mutable overlay on top of an immutable ObjectStore.
- error
- Error types for the rpdfium-edit crate.
- font_
reg - Font registration — FPDF_FONT handle equivalent.
- fpdf_
annot - Annotation editing — create, modify, and delete annotations on pages.
- fpdf_
edit - Page management — add, delete, move pages; insert/remove page objects.
- fpdf_
formfill - Form field persistence — update form field values and save.
- fpdf_
ppo - Parse human-readable 1-based page range strings (e.g.
"1,3,5-7") into 0-based index vectors. - object_
ctx - Context types for namespaced page-object and annotation-object access.
- page_
object - Page objects — typed wrappers for path, text, image, and form XObject content that can be placed on a page.
Structs§
- Counting
Writer - Position-tracking writer wrapper.
- Dash
Pattern - Dash pattern for stroked paths (PDF spec §8.4.3.6).
Enums§
- Blend
Mode - Blend mode for transparency compositing (PDF spec Table 136).
Traits§
- PdfWrite
- Trait for writing PDF bytes with position tracking.
Functions§
- write_
incremental - Write an incremental update appended to the original PDF data.