Skip to main content

Crate rpdfium_edit

Crate rpdfium_edit 

Source
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§

CountingWriter
Position-tracking writer wrapper.
DashPattern
Dash pattern for stroked paths (PDF spec §8.4.3.6).

Enums§

BlendMode
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.