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() -> Self

Create new PDF document.

source

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

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: ObjectId ) -> Result<()>

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: ObjectId ) -> Result<&mut Object>

Get the pages resources.

Get Object that has the key Resources.

source

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

Add XObject to a page.

Get Object that has the key Resources -> XObject.

source

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

Add Graphics State to a page.

Get Object that has the key Resources -> ExtGState.

source§

impl IncrementalDocument

source

pub fn load<P: AsRef<Path>>(path: P) -> Result<Self>

Load a PDF document from a specified file path.

source

pub fn load_from<R: Read>(source: R) -> Result<Self>

Load a PDF document from an arbitrary source.

source

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

Load a PDF document from a memory slice.

source§

impl IncrementalDocument

source

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

Save PDF document to specified file path.

source

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

Save PDF to arbitrary target

Trait Implementations§

source§

impl Clone for IncrementalDocument

source§

fn clone(&self) -> IncrementalDocument

Returns a copy 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

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

impl Default for IncrementalDocument

source§

fn default() -> Self

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

impl TryInto<IncrementalDocument> for &[u8]

§

type Error = Error

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

fn try_into(self) -> Result<IncrementalDocument>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.