#[non_exhaustive]pub enum PageTreeError {
NoPageTreeRoot,
BadKid(ObjId),
Cycle(ObjId),
TooDeep,
TooManyPages,
MissingRequired(&'static str),
BadResources,
BadRectangle(&'static str),
BadRotate(i64),
BadContents,
}Expand description
Page-tree structural errors.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoPageTreeRoot
The catalog has no usable /Pages entry.
BadKid(ObjId)
A Kids element resolved to something that is not a
dictionary (including a dangling reference’s null).
Cycle(ObjId)
A node was visited twice — the tree has a cycle.
TooDeep
Nesting exceeded MAX_TREE_DEPTH (pdfcer guard).
TooManyPages
More than MAX_PAGES leaves (pdfcer guard).
MissingRequired(&'static str)
A required inheritable attribute resolved nowhere on the path to the root (§7.7.3.4: “a value shall be supplied in an ancestor node”).
MediaBox only, since Pass 290.0. Resources used to
produce this too, and it was the wrong severity for the wrong
attribute: an absent resource dictionary means “no named resource is
available”, which is a statement the empty dictionary makes exactly,
whereas an absent MediaBox means the page has no geometry and
any value pdfcer chose (Letter? A4? the previous page’s?) would be
invented. Continuing requires inventing nothing; that is the line
decision 145 draws, and MediaBox is on the other side of it. See
Page::resources_defaulted.
BadResources
/Resources was present but resolved to something that is not a
dictionary — a number, a name, an array, a string or a stream.
Deliberately narrower than “the attribute is unusable”: an absent
/Resources, and one whose reference dangles (§7.3.10 makes that
the null object; §7.3.9 makes null “equivalent to omitting the
entry”), are not this error. Those degrade to the empty
dictionary and are disclosed through Page::resources_defaulted.
This variant is reserved for a value with no spec-sanctioned
reading, which is a real structural defect and must not be laundered
into a page that merely renders emptier — the same split
Self::BadContents makes, for the same reason.
BadRectangle(&'static str)
A rectangle entry wasn’t an array of four numbers.
BadRotate(i64)
Rotate was not an integer multiple of 90 (Table 30 “shall”).
BadContents
Contents held a value of the wrong type — something that is
neither a stream reference, an array of them, nor null.
Deliberately narrower than it looks: an element that resolves to
null (a dangling reference to an object the file does not
contain) is NOT this error. §7.3.10 defines such a reference to be
the null object and Table 30 makes an absent Contents an empty
page, so that case degrades — the element contributes nothing and
the omission is counted in Page::contents_unresolved. This
variant is reserved for values with no spec-sanctioned reading (a
number, a name, a dictionary, a non-reference array element), which
are real structural defects and must not be laundered into a silent
blank page.
Trait Implementations§
Source§impl Clone for PageTreeError
impl Clone for PageTreeError
Source§impl Debug for PageTreeError
impl Debug for PageTreeError
Source§impl Display for PageTreeError
impl Display for PageTreeError
Source§impl Error for PageTreeError
impl Error for PageTreeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()