Struct pdf_writer::PdfWriter[][src]

pub struct PdfWriter { /* fields omitted */ }
Expand description

The root writer.

Implementations

impl PdfWriter[src]

Core methods.

pub fn new(major: i32, minor: i32) -> Self[src]

Create a new PDF writer with the default buffer capacity (currently 8 KB).

This already writes the PDF header containing the (major, minor) version.

pub fn with_capacity(capacity: usize, major: i32, minor: i32) -> Self[src]

Create a new PDF writer with the specified initial buffer capacity.

This already writes the PDF header containing the (major, minor) version.

pub fn set_indent(&mut self, indent: usize)[src]

Set the indent level per layer of nested objects.

Default value: 0.

pub fn finish(self, catalog_id: Ref) -> Vec<u8>[src]

Write the cross-reference table and file trailer and return the underlying buffer.

pub fn len(&self) -> usize[src]

The number of bytes that were written so far.

impl PdfWriter[src]

Indirect objects.

pub fn indirect(&mut self, id: Ref) -> Obj<'_, IndirectGuard>[src]

Start writing an indirectly referenceable object.

pub fn catalog(&mut self, id: Ref) -> Catalog<'_>[src]

Start writing a document catalog.

pub fn pages(&mut self, id: Ref) -> Pages<'_>[src]

Start writing a page tree.

pub fn page(&mut self, id: Ref) -> Page<'_>[src]

Start writing a page.

pub fn type1_font(&mut self, id: Ref) -> Type1Font<'_>[src]

Start writing a Type-1 font.

pub fn type0_font(&mut self, id: Ref) -> Type0Font<'_>[src]

Start writing a Type-0 font.

pub fn cid_font(&mut self, id: Ref, subtype: CidFontType) -> CidFont<'_>[src]

Start writing a CID font.

pub fn font_descriptor(&mut self, id: Ref) -> FontDescriptor<'_>[src]

Start writing a font descriptor.

impl PdfWriter[src]

Streams.

pub fn stream<'a>(&'a mut self, id: Ref, data: &'a [u8]) -> Stream<'a>[src]

Start writing an indirectly referenceable stream.

The stream data and the /Length field are written automatically. You can add additional key-value pairs to the stream dictionary with the returned stream writer.

pub fn cmap<'a>(&'a mut self, id: Ref, cmap: &'a [u8]) -> CmapStream<'a>[src]

Start writing a character map stream.

If you want to use this for a /ToUnicode CMap, you can use the UnicodeCmap builder to construct the data.

pub fn image<'a>(&'a mut self, id: Ref, samples: &'a [u8]) -> ImageStream<'a>[src]

Start writing an XObject image stream.

Trait Implementations

impl Debug for PdfWriter[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.