pub struct CosDoc { /* private fields */ }Expand description
A low-level PDF document providing access to the COS object graph.
Implementations§
Source§impl CosDoc
impl CosDoc
Sourcepub fn trailer_mut(&mut self) -> &mut IndexMap<Vec<u8>, PdfObject>
pub fn trailer_mut(&mut self) -> &mut IndexMap<Vec<u8>, PdfObject>
Get a mutable reference to the trailer dictionary.
Sourcepub fn get_object(&mut self, obj_num: u32) -> Result<Option<&PdfObject>>
pub fn get_object(&mut self, obj_num: u32) -> Result<Option<&PdfObject>>
Get an object by its object number.
Returns the object directly (resolves the xref entry to load from file).
Sourcepub fn resolve(&mut self, obj: &PdfObject) -> Result<PdfObject>
pub fn resolve(&mut self, obj: &PdfObject) -> Result<PdfObject>
Resolve a PdfObject::Reference to the referenced object. Returns the object itself if it’s not a reference.
Sourcepub fn create_indirect(&mut self, obj: PdfObject) -> ObjectId
pub fn create_indirect(&mut self, obj: PdfObject) -> ObjectId
Create a new indirect object and return its ObjectId.
Sourcepub fn update_object(&mut self, obj_num: u32, obj: PdfObject)
pub fn update_object(&mut self, obj_num: u32, obj: PdfObject)
Update an existing indirect object.
Sourcepub fn is_modified(&self) -> bool
pub fn is_modified(&self) -> bool
Check if the document has been modified.
Sourcepub fn save_to_bytes(&mut self) -> Result<Vec<u8>>
pub fn save_to_bytes(&mut self) -> Result<Vec<u8>>
Save the document to bytes (full save, not incremental).
All objects are written as a flat traditional xref table, even if the original used xref streams or object streams.
Sourcepub fn save_to_file(&mut self, path: &str) -> Result<()>
pub fn save_to_file(&mut self, path: &str) -> Result<()>
Save the document to a file.
Auto Trait Implementations§
impl Freeze for CosDoc
impl RefUnwindSafe for CosDoc
impl Send for CosDoc
impl Sync for CosDoc
impl Unpin for CosDoc
impl UnsafeUnpin for CosDoc
impl UnwindSafe for CosDoc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more