Skip to main content

IncrementalDocument

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() -> 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 page’s resource dictionary (only in new document).

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 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

Source§

impl IncrementalDocument

Source

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

Load a PDF document from a specified file path.

Source

pub async fn load_from<R: AsyncRead>(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.

Trait Implementations§

Source§

impl Clone for IncrementalDocument

Source§

fn clone(&self) -> IncrementalDocument

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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]

Source§

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 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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