pub struct PdfWriter { /* private fields */ }Expand description
PDF document writer.
Builds a complete PDF document with pages, fonts, and content.
Implementations§
Source§impl PdfWriter
impl PdfWriter
Sourcepub fn with_config(config: PdfWriterConfig) -> Self
pub fn with_config(config: PdfWriterConfig) -> Self
Create a PDF writer with custom config.
Sourcepub fn set_outline(&mut self, outline: OutlineBuilder)
pub fn set_outline(&mut self, outline: OutlineBuilder)
Attach a document outline (bookmarks) to be emitted during
PdfWriter::finish. Replaces any previously-set outline.
Sourcepub fn set_page_labels(&mut self, labels: PageLabelsBuilder)
pub fn set_page_labels(&mut self, labels: PageLabelsBuilder)
Attach a /PageLabels number-tree (Roman numeral preface →
Arabic body etc.) to be emitted during finish.
Sourcepub fn register_embedded_font(&mut self, font: EmbeddedFont) -> String
pub fn register_embedded_font(&mut self, font: EmbeddedFont) -> String
Register an embedded TrueType font for use in content streams.
Returns the resource name (e.g. "EF1") that add_embedded_text
should use. The font is consumed; finish() emits its five PDF
objects (Type 0 / CIDFontType2 / FontDescriptor / FontFile2 stream
/ ToUnicode CMap stream — ISO 32000-1 §9.6.4 / §9.7.4 / §9.8 / §9.9
/ §9.10.2).
The font’s display name (used in PostScript/BaseFont fields) is
taken from EmbeddedFont::name. Callers wanting a stable subset
tag should track the resource name they get back and reuse it.
Sourcepub fn register_embedded_font_as(
&mut self,
user_name: impl Into<String>,
font: EmbeddedFont,
) -> String
pub fn register_embedded_font_as( &mut self, user_name: impl Into<String>, font: EmbeddedFont, ) -> String
Register an embedded TrueType font under a user-visible name
(e.g. "NotoSansCJKtc"). The name is what callers pass to
FluentPageBuilder::font(name, size) / FontSpec::name; when
a ContentElement::Text is dispatched, the PageBuilder looks
up this map and routes matching elements through
add_embedded_text (hex-encoded Type-0 emission) instead of the
base-14 map_font_name fallback that silently collapses unknown
names to Helvetica.
Returns the EFn resource name for callers that want to mix
low-level add_embedded_text calls with the high-level path.
Sourcepub fn add_page(&mut self, width: f32, height: f32) -> PageBuilder<'_>
pub fn add_page(&mut self, width: f32, height: f32) -> PageBuilder<'_>
Add a page with the given dimensions.
Sourcepub fn add_letter_page(&mut self) -> PageBuilder<'_>
pub fn add_letter_page(&mut self) -> PageBuilder<'_>
Add a US Letter sized page (8.5“ x 11“).
Sourcepub fn add_a4_page(&mut self) -> PageBuilder<'_>
pub fn add_a4_page(&mut self) -> PageBuilder<'_>
Add an A4 sized page (210mm x 297mm).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PdfWriter
impl RefUnwindSafe for PdfWriter
impl Send for PdfWriter
impl Sync for PdfWriter
impl Unpin for PdfWriter
impl UnsafeUnpin for PdfWriter
impl UnwindSafe for PdfWriter
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.