Skip to main content

Compromise

Enum Compromise 

Source
#[non_exhaustive]
pub enum Compromise { FontSubstituted { font: ObjRef, base_name: String, substitute: &'static str, }, ActionRemoved { holder: ObjRef, kind: String, }, AnnotationRemoved { annotation: ObjRef, page: u32, subtype: String, }, AnnotationFlagsChanged { annotation: ObjRef, page: u32, }, PageRasterized { page: u32, dpi: Dpi, cause: RasterCause, }, EmbeddedFileRemoved { file: Option<ObjRef>, name: String, }, OptionalContentRemoved { catalog: ObjRef, }, ObjectMetadataRemoved { object: ObjRef, }, }
Expand description

One thing the conversion did that changed the document.

Every variant carries the object or page it happened to, for the same reason Subject does: a caller that wants to show the user what changed needs to reach the thing, and a sentence cannot be turned back into an ObjRef.

This is the complete list of ways the conversion can alter meaning. A repair that changes nothing a reader would notice — minting a /ID, writing an output intent, rewriting the XMP packet — is not a compromise and does not appear here.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

FontSubstituted

A font’s program was not in the file and could not be obtained, so a standard font was substituted. The glyphs the page draws change.

Never produced yet, like Compromise::PageRasterized: the substitution behind Policy::unembeddable_font is not implemented. Both are here rather than added with their repairs because each completes a triple that is live — the policy field, the Refusal a caller gets today, and the compromise they will get instead. A caller writes the match arm once.

Fields

§font: ObjRef

The font dictionary that was rewritten.

§base_name: String

The /BaseFont name it had.

§substitute: &'static str

The standard font put in its place.

§

ActionRemoved

An action was removed: JavaScript, or one of the kinds the level forbids by name.

Fields

§holder: ObjRef

The object the action hung off — a catalog, an annotation, a field.

§kind: String

The /S subtype removed, as PDF spells it.

§

AnnotationRemoved

An annotation was removed because its subtype is not permitted.

Fields

§annotation: ObjRef

The annotation dictionary.

§page: u32

The page it was on.

§subtype: String

Its /Subtype.

§

AnnotationFlagsChanged

An annotation was kept but its flag word was corrected, so it now prints and is visible where it was not.

Fields

§annotation: ObjRef

The annotation dictionary.

§page: u32

The page it is on.

§

PageRasterized

A page was rendered to an image and rebuilt around it. Its text is no longer text and its vectors are no longer vectors.

Never produced yet: the rasterizing repair is not implemented. The variant is part of the vocabulary because Conversion::rasterized_pages reports which pages changed, and a caller writes that match arm once, not when the repair lands.

Fields

§page: u32

The page, zero-based.

§dpi: Dpi

The resolution it was rendered at, in whole dots per inch.

An integer newtype rather than an f32: a fractional render resolution is not a thing a caller asks for, and f32 would cost this whole report its Eq.

§cause: RasterCause

Why the page could not be kept as content.

§

EmbeddedFileRemoved

An embedded file was removed. A-1b forbids them outright.

Fields

§file: Option<ObjRef>

The name tree entry, when the file specification is indirect.

§name: String

The file’s name, as the name tree spelled it.

§

OptionalContentRemoved

Optional content was removed, so what was conditionally visible is now unconditionally so. A-1b forbids /OCProperties.

Fields

§catalog: ObjRef

The catalog the /OCProperties hung off.

§

ObjectMetadataRemoved

A /Metadata packet on an object other than the catalog was removed.

PDF/A’s schema rules apply to every packet in the file, and a packet on an image describing its camera or its rights holder usually uses schemas PDF/A does not predefine. Nothing renders differently without it — it is descriptive metadata, not content — but it is information the file no longer carries, so the caller is told.

Fields

§object: ObjRef

The object it hung off.

Trait Implementations§

Source§

impl Clone for Compromise

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Compromise

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Compromise

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Compromise

Source§

impl PartialEq for Compromise

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Compromise

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.