pub struct PdfFile {
pub header: PdfHeader,
pub xref: XrefTable,
pub trailer: PdfDict,
/* private fields */
}Fields§
§header: PdfHeader§xref: XrefTable§trailer: PdfDictImplementations§
Source§impl PdfFile
impl PdfFile
pub fn parse(data: impl Into<Arc<[u8]>>) -> Result<Self>
pub fn parse_with_limits( data: impl Into<Arc<[u8]>>, limits: ParseLimits, ) -> Result<Self>
Sourcepub fn parse_with_password(
data: impl Into<Arc<[u8]>>,
password: &[u8],
) -> Result<Self>
pub fn parse_with_password( data: impl Into<Arc<[u8]>>, password: &[u8], ) -> Result<Self>
Open with a user/owner password (for documents the empty password cannot
decrypt). Returns zpdf_core::Error::WrongPassword if it authenticates
as neither.
pub fn parse_with_password_and_limits( data: impl Into<Arc<[u8]>>, password: &[u8], limits: ParseLimits, ) -> Result<Self>
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
True when the trailer carries an /Encrypt dictionary. Note this does not
imply decryption succeeded — open the document to find out.
pub fn resolve(&self, id: ObjectId) -> Result<PdfObject>
Sourcepub fn resolve_stream_data(&self, id: ObjectId) -> Result<Vec<u8>>
pub fn resolve_stream_data(&self, id: ObjectId) -> Result<Vec<u8>>
Resolve a stream object and decode its data through the filter pipeline.
/Filter and /DecodeParms may be indirect references (or arrays
containing them); resolve those before handing the dict to the filter
layer, which has no access to the file.
pub fn data(&self) -> &[u8] ⓘ
Sourcepub fn force_repair_scan(&self) -> Option<&XrefTable>
pub fn force_repair_scan(&self) -> Option<&XrefTable>
Force-build (once) and return the full-file repair-scan table, or None
if the scan found nothing. Shares the OnceCell the lazy per-object
repair uses, so the scan runs at most once per PdfFile.
Sourcepub fn all_object_ids(&self) -> Vec<ObjectId>
pub fn all_object_ids(&self) -> Vec<ObjectId>
Every object id known to this file: the live xref unioned with the
repair-scan table (built on demand). Deduped and sorted by (num, gen).
Sourcepub fn find_objects_by_type(&self, ty: &str) -> Vec<ObjectId>
pub fn find_objects_by_type(&self, ty: &str) -> Vec<ObjectId>
All objects whose dict /Type equals ty, in (num, gen) order.
Resolves through Self::resolve (so /ObjStm members are decoded and,
for encrypted files, decrypted) and falls back to the repair table for
ids the live xref lacks. Bounded by limits.max_objects. The document
layer uses this to rebuild a page list when the /Pages tree is
unreachable.