#[non_exhaustive]pub struct SaveOptions {
pub producer: ProducerPolicy,
pub xref_entry_eol: XrefEntryEol,
pub trailing_eol: TrailingEol,
pub edited_stream_compression: EditedStreamCompression,
}Expand description
Options controlling a save.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.producer: ProducerPolicy/Producer handling for save_full. Ignored by
save_incremental, which never touches /Info.
xref_entry_eol: XrefEntryEolWhich of §7.5.4’s three permitted two-byte terminators ends a
classic cross-reference entry (spec ambiguity EOL-A1, R169).
Default XrefEntryEol::SpaceLf — the form pdfcer has always
emitted. Evidence tier (c), downgrade pending: the spec RAG
calls SP LF “the common choice” but the register’s §11.3 flags
that the claim carries no citation and should either gain one or
drop to tier (d).
Applies to newly written cross-reference entries only, so an incremental save changes nothing about the base revision’s bytes.
trailing_eol: TrailingEolWhether an end-of-line byte follows the final %%EOF (spec
ambiguity EOL-A2, R169).
Default TrailingEol::Lf — what pdfcer has always emitted.
Evidence tier (d), a reasoned guess and the safe side of one:
§7.2.3 needs an EOL before a following N G obj on the append
path anyway, and a trailing EOL never breaks a backward %%EOF
scan.
edited_stream_compression: EditedStreamCompressionHow an edited stream whose source was /FlateDecode is written.
Default EditedStreamCompression::KeepSourceFilter: edit routes
stage decoded bytes, so without this a 1.6 MB compressed content
stream is saved as 14 MB of plain text.
Implementations§
Source§impl SaveOptions
impl SaveOptions
Sourcepub fn identity() -> Self
pub fn identity() -> Self
Options that leave every byte pdfcer did not have to change exactly as it was — the settings the round-trip harness and the per-object byte-identity gate run under.
The two §7.5 end-of-line knobs stay at their defaults here
rather than tracking the operator’s persisted choice, and that is
deliberate: identity() names a byte-comparison posture, and a
harness whose expected bytes depend on a settings file is a harness
that fails on one machine and passes on another. An operator-facing
save path applies the persisted values explicitly; this one does
not, and says so.
Sourcepub const fn with_edited_stream_compression(
self,
c: EditedStreamCompression,
) -> Self
pub const fn with_edited_stream_compression( self, c: EditedStreamCompression, ) -> Self
Set how an edited, formerly Flate-compressed stream is written,
consuming and returning self.
Sourcepub const fn with_xref_entry_eol(self, eol: XrefEntryEol) -> Self
pub const fn with_xref_entry_eol(self, eol: XrefEntryEol) -> Self
Set the classic cross-reference entry terminator (EOL-A1),
consuming and returning self.
BYTES blast radius. Every value §7.5.4 permits is conforming, so this changes bytes and nothing else; it exists so an operator matching another tool’s output byte-for-byte can.
Sourcepub const fn with_trailing_eol(self, eol: TrailingEol) -> Self
pub const fn with_trailing_eol(self, eol: TrailingEol) -> Self
Set whether a trailing end-of-line follows %%EOF (EOL-A2),
consuming and returning self.
Sourcepub const fn with_producer(self, producer: ProducerPolicy) -> Self
pub const fn with_producer(self, producer: ProducerPolicy) -> Self
Set the /Producer policy, consuming and returning self.
A setter rather than a struct-literal field because
SaveOptions is #[non_exhaustive]: downstream crates
(pdfcer, pdfce-gui, the round-trip harness) cannot use a
struct expression at all, and adding an option in a later Pass
must not be a breaking change for them.