Expand description
Pure-Rust PDF writer for the oxideav framework — round 1.
Round 1 supports a single-page PDF 1.4 document built from one
oxideav_core::vector::VectorFrame. The imaging-model surface
emitted is the SVG / PDF intersection that oxideav-core already
models:
- Paths — move / line / cubic / quadratic (lifted to cubic) / elliptic-arc (flattened to cubic) / close.
- Solid + linear/radial gradient fills (Pattern Type 2 + Function Type 2 / Type 3 stitching).
- Strokes — width, cap, join, miter limit, dash array+offset.
- 2D affine transforms (
cm). - Groups with optional opacity (ExtGState
/ca+/CA) and clip path (W n). - Embedded raster images as FlateDecode
ImageXObjects with per-pixel alpha viaSMask. RGBA8 only — JPEG passthrough, palette images, and 16-bit depth are round 2.
Text rendering, multi-page output, transparency groups beyond a
per-Group /ca+/CA opacity, and PDF reading are all out of
scope for round 1 — see README.md for the full deferred list.
§Public surface
use oxideav_core::{Group, VectorFrame, time::TimeBase};
let frame = VectorFrame {
width: 100.0,
height: 100.0,
view_box: None,
root: Group::default(),
pts: None,
time_base: TimeBase::new(1, 1),
};
let bytes = oxideav_pdf::write_pdf(&frame).unwrap();
assert!(bytes.starts_with(b"%PDF-1.4"));The crate also registers itself with oxideav_core::CodecRegistry
so it can be selected via the standard codec-id lookup
("pdf").
Re-exports§
pub use acroform::write_pdf_with_form;pub use acroform::FieldJustification;pub use acroform::FormField;pub use acroform::FormFieldCheckbox;pub use acroform::FormFieldChoice;pub use acroform::FormFieldRadioGroup;pub use acroform::FormFieldSignature;pub use acroform::FormFieldText;pub use acroform::RadioOption;pub use annotations::write_pdf_with_annotations;pub use annotations::Annotation;pub use annotations::AnnotationKind as WriterAnnotationKind;pub use annotations::CaretSymbol;pub use annotations::FixedPrintSpec;pub use annotations::FreeTextQuadding;pub use annotations::SoundEncoding;pub use attachments::write_pdf_with_annotations_and_attachments;pub use attachments::write_pdf_with_attachments;pub use attachments::AfRelationship;pub use attachments::Attachment;pub use error::PdfError;pub use outline::LinkAnnotationSpec;pub use outline::LinkTarget;pub use outline::OutlineDestination;pub use outline::OutlineSpec;pub use pubsec::open_with_certificate;pub use pubsec::open_with_certificate_and_trust_store;pub use pubsec::open_with_certificate_and_trust_store_with_permissions;pub use pubsec::open_with_certificate_with_permissions;pub use pubsec::CertRef;pub use pubsec::KariRecipient;pub use pubsec::PubSecCfGroup;pub use pubsec::PubSecCredential;pub use pubsec::PubSecEncoderConfig;pub use pubsec::PubSecEncryptionState;pub use pubsec::PubSecKariConfig;pub use pubsec::PubSecMatch;pub use pubsec::PubSecMultiCfConfig;pub use pubsec::PubSecRecipient;pub use pubsec::PubSecSubFilter;pub use pubsec::TrustStore;pub use reader::doc_timestamps as read_pdf_doc_timestamps;pub use reader::actions as read_pdf_actions;pub use reader::actions as read_pdf_actions;pub use reader::annotations as read_pdf_annotations;pub use reader::attachments as read_pdf_attachments;pub use reader::attachments as read_pdf_attachments;pub use reader::extract_text as extract_pdf_text;pub use reader::extract_text_marked as extract_pdf_text_marked;pub use reader::image_xobjects as read_pdf_image_xobjects;pub use reader::inline_images as read_pdf_inline_images;pub use reader::inline_images as read_pdf_inline_images;pub use reader::links as read_pdf_links;pub use reader::outline as read_pdf_outline;pub use reader::outline as read_pdf_outline;pub use reader::parse_linearization_dict;pub use reader::pdfa_signals as read_pdf_pdfa_signals;pub use reader::read_in_logical_order as read_pdf_in_logical_order;pub use reader::read_pdf_to_scene;pub use reader::read_pdf_to_scene_with_certificate;pub use reader::read_pdf_to_scene_with_certificate_and_trust_store;pub use reader::read_pdf_to_scene_with_password;pub use reader::signatures as read_pdf_signatures;pub use reader::signed_bytes as pdf_signed_bytes;pub use reader::verify_hierarchy as verify_pdf_hierarchy;pub use reader::ActionKind;pub use reader::ActionTrigger;pub use reader::AnnotationAppearance;pub use reader::AnnotationKind;pub use reader::ColorSpace;pub use reader::FixedPrint;pub use reader::HierarchyIssue;pub use reader::HierarchyReport;pub use reader::InlineImageFilter;pub use reader::IssueSeverity;pub use reader::LayoutMode;pub use reader::LinearizationParams;pub use reader::MarkedTextRun;pub use reader::MovieActivation;pub use reader::OutlineNode;pub use reader::PdfACatalogSignals;pub use reader::PdfAConformance;pub use reader::PdfAction;pub use reader::PdfAnnotation;pub use reader::PdfAttachment;pub use reader::PdfDocTimestamp;pub use reader::PdfImageXObject;pub use reader::PdfInlineImage;pub use reader::PdfLink;pub use reader::PdfLinkTarget;pub use reader::PdfMarkedTextExtraction;pub use reader::PdfOutline;pub use reader::PdfSignature;pub use reader::PdfTextExtraction;pub use reader::ReadingOrderText;pub use reader::TextMarkupVariant;pub use reader::TextRenderMode;pub use reader::TextRun;pub use reader::ThreeDActivation;pub use reader::ThreeDViewSelector;pub use reader::XmpPacket;pub use sig::add_document_timestamp;pub use sig::build_tst_info;pub use sig::pkcs7_wrap_signed_data;pub use sig::sign_pdf_from_scene;pub use sig::wrap_tst_in_signed_data;pub use sig::EcdsaP256Sha256Signer;pub use sig::MessageImprint;pub use sig::MockTsaSigner;pub use sig::RsaPkcs1v15Sha256Signer;pub use sig::SigWriter;pub use sig::Signer;pub use sig::SignerIdentity;pub use sig::SigningAlgorithm;pub use sig::TsaSigner;pub use sig::OID_CT_TST_INFO;pub use writer::write_pdf;pub use writer::write_pdf_from_scene;pub use writer::write_pdf_from_scene_encrypted;pub use writer::write_pdf_from_scene_linearized;pub use writer::write_pdf_from_scene_object_stream;pub use writer::write_pdf_from_scene_object_stream_encrypted;pub use writer::write_pdf_from_scene_pubsec_encrypted;pub use writer::write_pdf_from_scene_pubsec_kari;pub use writer::write_pdf_from_scene_pubsec_multi_cf;pub use writer::write_pdf_from_scene_with_outlines;pub use writer::write_pdf_from_scene_with_outlines_and_links;pub use writer::write_pdf_from_scene_with_xmp;pub use writer::write_pdf_from_scene_xref_stream;pub use writer::write_pdf_incremental_update;
Modules§
- acroform
- Round-31 — AcroForm interactive-widget writer (ISO 32000-1 §12.7).
- annotations
- Round-32 — general annotations writer (ISO 32000-1 §12.5).
- arc
- SVG elliptic-arc to cubic-Bezier flattening.
- attachments
- Round-33 — embedded file attachment writer (ISO 32000-1 §7.11 + §3.10 + §12.5.6.15).
- decrypt
- PDF decryption support — ISO 32000-1 §7.6 / ISO 32000-2 §7.6 Standard Security Handler.
- encrypt
- PDF encryption writer-side support — ISO 32000-1 §7.6.3 + ISO 32000-2 §7.6.4 Standard Security Handler.
- error
- Crate-local error type.
- info
- Document information dictionary (ISO 32000-1 §14.3.3).
- linearize
- Linearized PDF writer (ISO 32000-1 §7.5.6 + Annex F).
- objects
- PDF object model and serializer (ISO 32000-1 §7.3 / §7.5).
- operators
- PDF content-stream operator emitter (ISO 32000-1 §8.5).
- outline
- Round-25: PDF outline (bookmark) tree + Link annotation specs.
- page
- Page object construction.
- pubsec
- PDF public-key security handler — ISO 32000-1 §7.6.4 + ISO 32000-2 §7.6.5.
- reader
- PDF reader — byte-stream → typed object tree → high-level Scene.
- resources
- Resource-dictionary collector — ExtGState, Pattern, XObject.
- sig
- PDF
/Sigannotation writer — round 30. - writer
- Top-level PDF writer.
Constants§
- CODEC_
ID_ STR - String form of the
oxideav_core::CodecIdthis crate registers under. Use it from container code that wants to claim PDF as an output target.
Functions§
- register
- Unified registration entry point — installs the PDF encoder into
the codec sub-registry and the PDF muxer into the container
sub-registry of the supplied
RuntimeContext. - register_
codecs - Register the PDF encoder with
codecs. - register_
containers - Register the PDF muxer with
containers.