pub struct COSDocument {
pub objects: BTreeMap<ObjectId, COSObject>,
pub trailer: COSDictionary,
pub version: String,
pub max_object_number: u32,
pub dirty_objects: BTreeSet<ObjectId>,
}Expand description
Low-level PDF document holding all COS objects and the trailer dictionary.
Fields§
§objects: BTreeMap<ObjectId, COSObject>§trailer: COSDictionary§version: String§max_object_number: u32§dirty_objects: BTreeSet<ObjectId>Implementations§
Source§impl COSDocument
impl COSDocument
pub fn new() -> Self
Sourcepub fn allocate_id(&mut self) -> ObjectId
pub fn allocate_id(&mut self) -> ObjectId
Allocates a new, unique object id with generation 0.
Sourcepub fn add_object<T: Into<COSObject>>(&mut self, obj: T) -> ObjectId
pub fn add_object<T: Into<COSObject>>(&mut self, obj: T) -> ObjectId
Stores a new object and returns its allocated ObjectId.
Sourcepub fn set_object<T: Into<COSObject>>(&mut self, id: ObjectId, obj: T)
pub fn set_object<T: Into<COSObject>>(&mut self, id: ObjectId, obj: T)
Sets or replaces an object with a specific ObjectId and marks it dirty.
Sourcepub fn get_object(&self, id: ObjectId) -> Option<&COSObject>
pub fn get_object(&self, id: ObjectId) -> Option<&COSObject>
Retrieves an object by its ObjectId.
Sourcepub fn get_object_mut(&mut self, id: ObjectId) -> Option<&mut COSObject>
pub fn get_object_mut(&mut self, id: ObjectId) -> Option<&mut COSObject>
Retrieves a mutable reference to an object by its ObjectId and marks it dirty.
Sourcepub fn resolve<'a>(&'a self, obj: &'a COSObject) -> &'a COSObject
pub fn resolve<'a>(&'a self, obj: &'a COSObject) -> &'a COSObject
Resolves an object: if it’s a Reference, fetches the target object; otherwise returns the object.
Sourcepub fn get_resolved(&self, id: ObjectId) -> PdfResult<&COSObject>
pub fn get_resolved(&self, id: ObjectId) -> PdfResult<&COSObject>
Resolves a reference or returns error if not found.
Sourcepub fn get_catalog(&self) -> Option<&COSDictionary>
pub fn get_catalog(&self) -> Option<&COSDictionary>
Gets the Document Catalog dictionary (/Root).
Sourcepub fn get_catalog_mut(&mut self) -> Option<&mut COSDictionary>
pub fn get_catalog_mut(&mut self) -> Option<&mut COSDictionary>
Gets mutable Document Catalog dictionary.
Sourcepub fn get_info(&self) -> Option<&COSDictionary>
pub fn get_info(&self) -> Option<&COSDictionary>
Gets Document Information dictionary (/Info).
Sourcepub fn clear_dirty(&mut self)
pub fn clear_dirty(&mut self)
Clears the dirty tracking set (e.g. after saving).
Trait Implementations§
Source§impl Clone for COSDocument
impl Clone for COSDocument
Source§fn clone(&self) -> COSDocument
fn clone(&self) -> COSDocument
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for COSDocument
impl Debug for COSDocument
Auto Trait Implementations§
impl Freeze for COSDocument
impl RefUnwindSafe for COSDocument
impl Send for COSDocument
impl Sync for COSDocument
impl Unpin for COSDocument
impl UnsafeUnpin for COSDocument
impl UnwindSafe for COSDocument
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