pub enum PdfObject {
Null,
Bool(bool),
Integer(i64),
Real(f64),
Name(Vec<u8>),
Str(Vec<u8>),
Array(Vec<PdfObject>),
Dict(IndexMap<Vec<u8>, PdfObject>),
Reference(ObjectId),
Stream(PdfStream),
}Expand description
A PDF object.
This enum represents all 8 PDF object types plus an indirect reference. Stream objects are represented separately as they contain both a dictionary and binary data.
Variants§
Null
The null object.
Bool(bool)
A boolean value.
Integer(i64)
An integer value (PDF integers are at least 32-bit).
Real(f64)
A real (floating-point) value.
Name(Vec<u8>)
A name object (e.g., /Type, /Page). Stored without the leading ‘/’.
Str(Vec<u8>)
A string object (literal or hex string).
Array(Vec<PdfObject>)
An array of objects.
Dict(IndexMap<Vec<u8>, PdfObject>)
A dictionary mapping name keys to object values.
Reference(ObjectId)
A reference to an indirect object.
Stream(PdfStream)
A stream object (dictionary + binary data). The data is stored in decoded (uncompressed) form when possible.
Implementations§
Source§impl PdfObject
impl PdfObject
pub fn is_null(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_integer(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_name(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_array(&self) -> bool
pub fn is_dict(&self) -> bool
pub fn is_stream(&self) -> bool
pub fn is_reference(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn as_i64(&self) -> Option<i64>
pub fn as_f64(&self) -> Option<f64>
pub fn as_name(&self) -> Option<&[u8]>
Sourcepub fn as_name_str(&self) -> Option<String>
pub fn as_name_str(&self) -> Option<String>
Get name as a UTF-8 string (lossy).
pub fn as_str(&self) -> Option<&[u8]>
pub fn as_array(&self) -> Option<&[PdfObject]>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<PdfObject>>
pub fn as_dict(&self) -> Option<&IndexMap<Vec<u8>, PdfObject>>
pub fn as_dict_mut(&mut self) -> Option<&mut IndexMap<Vec<u8>, PdfObject>>
pub fn as_reference(&self) -> Option<ObjectId>
pub fn as_stream(&self) -> Option<&PdfStream>
Sourcepub fn dict_get(&self, key: &[u8]) -> Option<&PdfObject>
pub fn dict_get(&self, key: &[u8]) -> Option<&PdfObject>
Look up a key in a dictionary (or stream dictionary).
Sourcepub fn dict_get_i64(&self, key: &[u8]) -> Option<i64>
pub fn dict_get_i64(&self, key: &[u8]) -> Option<i64>
Look up a key and get it as an integer.
Sourcepub fn dict_get_f64(&self, key: &[u8]) -> Option<f64>
pub fn dict_get_f64(&self, key: &[u8]) -> Option<f64>
Look up a key and get it as a float.
Sourcepub fn dict_get_name(&self, key: &[u8]) -> Option<&[u8]>
pub fn dict_get_name(&self, key: &[u8]) -> Option<&[u8]>
Look up a key and get it as a name.
Sourcepub fn dict_get_name_str(&self, key: &[u8]) -> Option<String>
pub fn dict_get_name_str(&self, key: &[u8]) -> Option<String>
Look up a key and get it as a name string.
Sourcepub fn dict_get_bool(&self, key: &[u8]) -> Option<bool>
pub fn dict_get_bool(&self, key: &[u8]) -> Option<bool>
Look up a key and get it as a boolean.