#[non_exhaustive]pub struct SaveOptions {
pub mode: SaveMode,
pub keep_original: bool,
pub remove_security: bool,
pub subset_new_fonts: bool,
pub version: Option<PdfVersion>,
pub id_source: IdSource,
pub encrypt: Option<Encryption>,
}Expand description
Everything a save may be asked to do differently.
#[non_exhaustive], so a later option is an addition rather than a break;
build one with SaveOptions::builder, or start from
SaveOptions::default and assign the fields.
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.mode: SaveModeWhether to append or rewrite.
keep_original: boolKeep the original bytes as the file’s prefix. Only an incremental save reads this; clearing it there turns the save into a rewrite that keeps the appended shape.
remove_security: boolDrop the security handler and /Encrypt, writing the document in the
clear.
Off by default: an encrypted document saves encrypted under its own handler, and opens with the password it was opened with. Setting this is the explicit way to decrypt one on the way out — and it forces a full save, since plaintext cannot be appended behind ciphertext.
Has no effect on an unencrypted document.
subset_new_fonts: boolSubset newly embedded fonts, dropping the glyphs no page shows.
Off by default. When set, every font this save writes as a new
object and that a show operator on some page draws with is replaced by
a subset carrying only the glyphs still used, named ABCDEF+Original
after ISO 32000-1 §9.6.4.
What it subsets: a /Type0 font whose descendant is a
CIDFontType2 with an embedded /FontFile2. Nothing else — a Type 1
(/FontFile) or OpenType-CFF (/FontFile3, or an OTTO program)
font is left alone, and so is a simple TrueType font, whose codes
reach glyphs through a cmap the subsetter removes.
What it does not disturb: the character codes on the page, the
CIDs they map to, /W, and /ToUnicode. The subsetter renumbers
glyphs, and a rewritten /CIDToGIDMap absorbs that renumbering at the
one place ISO 32000-1 §9.7.4.2 already provides for it — so no
content stream is regenerated, and text extraction over the saved
file is unchanged.
A font whose program will not subset, or whose subset would not be smaller, is written unchanged.
version: Option<PdfVersion>The version to declare in the header. 1.0 through 1.7 are honoured;
anything outside that range, and None, keep the document’s own.
id_source: IdSourceWhere /ID and subset tags come from.
encrypt: Option<Encryption>Encrypt an unencrypted document on the way out: AES-256, revision 6,
under these passwords and permissions. None leaves the document as
it is. A document that is already encrypted cannot be re-keyed here:
asking for it is Error::EncryptedSaveUnsupported.
Implementations§
Source§impl SaveOptions
impl SaveOptions
Sourcepub fn builder() -> SaveOptionsBuilder
pub fn builder() -> SaveOptionsBuilder
A builder over the defaults.
use pdfrum_edit::{SaveMode, SaveOptions};
let options = SaveOptions::builder()
.mode(SaveMode::Incremental)
.subset_new_fonts(true)
.build();
assert_eq!(options.mode, SaveMode::Incremental);
assert!(options.subset_new_fonts);Trait Implementations§
Source§impl Clone for SaveOptions
impl Clone for SaveOptions
Source§impl Debug for SaveOptions
impl Debug for SaveOptions
Source§impl Default for SaveOptions
impl Default for SaveOptions
impl Eq for SaveOptions
Source§impl PartialEq for SaveOptions
impl PartialEq for SaveOptions
impl StructuralPartialEq for SaveOptions
Auto Trait Implementations§
impl Freeze for SaveOptions
impl RefUnwindSafe for SaveOptions
impl Send for SaveOptions
impl Sync for SaveOptions
impl Unpin for SaveOptions
impl UnsafeUnpin for SaveOptions
impl UnwindSafe for SaveOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.