pub fn read<R: Resolve>(
catalog: &Dict,
info: Option<&Dict>,
pages: &[Dict],
path: &str,
r: &R,
) -> DocumentModeljavascript only.Expand description
Reads a whole document into a DocumentModel.
The one place the object model meets a PDF, and it is deliberately a function over a catalog rather than a method on anything: it takes what it reads and hands back a value, so the cascade still holds no document and a caller with its own document type can write its own reader instead.
path is what Doc.path and Doc.URL answer, which no PDF carries — it
is the file the host opened, and only the host knows it.
info is the trailer’s /Info, which the catalog cannot reach.
Passing None is not the same as passing an empty dictionary: with no
/Info at all every metadata getter and Doc.info itself throw
Object no longer exists., where an empty one answers "" eight times.
pages is each page’s dictionary in order — the page count, the
/Annots walk Doc.getAnnots reports, and the page each field’s widgets
sit on all come from it.