Struct IncrementalDocument

Source
pub struct IncrementalDocument {
    pub new_document: Document,
    /* private fields */
}

Fields§

§new_document: Document

A new document appended to the previously loaded file.

Implementations§

Source§

impl IncrementalDocument

Source

pub fn new() -> IncrementalDocument

Create new PDF document.

Source

pub fn create_from( prev_bytes: Vec<u8>, prev_documents: Document, ) -> IncrementalDocument

Create new IncrementalDocument from the bytes and document.

The function expects the bytes and previous document to match. If they do not match exactly this might result in broken PDFs.

Source

pub fn get_prev_documents(&self) -> &Document

Get the structure of the previous documents (all prev incremental updates combined.)

Source

pub fn get_prev_documents_bytes(&self) -> &[u8]

Get the bytes of the previous documents.

Source

pub fn opt_clone_object_to_new_document( &mut self, object_id: (u32, u16), ) -> Result<(), Error>

Clone Object from previous document to new document. If the object already exists nothing is done.

This function can be used to clone an object so it can be changed in the incremental updates.

Source

pub fn get_or_create_resources( &mut self, page_id: (u32, u16), ) -> Result<&mut Object, Error>

Get the page’s resource dictionary (only in new document).

Get Object that has the key Resources.

Source

pub fn add_xobject<N>( &mut self, page_id: (u32, u16), xobject_name: N, xobject_id: (u32, u16), ) -> Result<(), Error>
where N: Into<Vec<u8>>,

Add XObject to a page.

Get Object that has the key Resources -> XObject.

Source

pub fn add_graphics_state<N>( &mut self, page_id: (u32, u16), gs_name: N, gs_id: (u32, u16), ) -> Result<(), Error>
where N: Into<Vec<u8>>,

Add Graphics State to a page.

Get Object that has the key Resources -> ExtGState.

Source§

impl IncrementalDocument

Source

pub fn save<P>(&mut self, path: P) -> Result<File, Error>
where P: AsRef<Path>,

Save PDF document to specified file path.

Source

pub fn save_to<W>(&mut self, target: &mut W) -> Result<(), Error>
where W: Write,

Save PDF to arbitrary target

Source§

impl IncrementalDocument

Source

pub fn load<P>(path: P) -> Result<IncrementalDocument, Error>
where P: AsRef<Path>,

Load a PDF document from a specified file path.

Source

pub fn load_from<R>(source: R) -> Result<IncrementalDocument, Error>
where R: Read,

Load a PDF document from an arbitrary source.

Source

pub fn load_mem(buffer: &[u8]) -> Result<Document, Error>

Load a PDF document from a memory slice.

Trait Implementations§

Source§

impl Clone for IncrementalDocument

Source§

fn clone(&self) -> IncrementalDocument

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IncrementalDocument

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for IncrementalDocument

Source§

fn default() -> IncrementalDocument

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

impl TryInto<IncrementalDocument> for &[u8]

Source§

type Error = Error

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

fn try_into(self) -> Result<IncrementalDocument, Error>

Performs the conversion.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V