Skip to main content

PdfWriter

Struct PdfWriter 

Source
pub struct PdfWriter { /* private fields */ }

Implementations§

Source§

impl PdfWriter

Source

pub fn new() -> Self

Source

pub fn alloc(&mut self) -> Ref

Source

pub fn object(&mut self, id: Ref, body: &str)

Writes a plain indirect object: id 0 obj\n<body>\nendobj\n.

Source

pub fn stream(&mut self, id: Ref, dict_extra: &str, data: &[u8])

Writes an indirect stream object, uncompressed. dict_extra are additional dictionary entries (e.g. /Length1 1234); /Length is computed and added automatically.

Source

pub fn compressed_stream(&mut self, id: Ref, dict_extra: &str, data: &[u8])

Self::stream’s DEFLATE-compressed counterpart (ADR-016): adds /Filter /FlateDecode and zlib-wraps data (RFC 1950 — what /FlateDecode expects per PDF 32000-1 7.4.4) before writing. Used for content streams, embedded font programs (FontFile2) and ToUnicode CMaps — never for data that’s already compressed (e.g. JPEG /DCTDecode samples), where re-deflating near-random bytes wastes CPU for ~0 size benefit.

Trait Implementations§

Source§

impl Default for PdfWriter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.