Skip to main content

detect

Function detect 

Source
pub fn detect(buf: &[u8]) -> Linearization
Expand description

Detect Annex F linearization in buf.

Follows the F.3.3 recipe in the module docs. Never allocates beyond the parsed dictionary, never touches the cross-reference table, and never fails: every malformed shape is simply “not linearized”, because F.1 already prescribes exactly that outcome for a file whose linearization information does not check out.

§Examples

use pdfcer_model::linearization::{detect, Linearization};

// A file with no parameter dictionary is simply not linearized.
assert_eq!(detect(b"%PDF-1.7\n1 0 obj\n<</Type /Catalog>>\nendobj\n"),
           Linearization::None);