Skip to main content

QPDFJobConfig

Struct QPDFJobConfig 

Source
pub struct QPDFJobConfig<'a> { /* private fields */ }
Expand description

Fluent configuration proxy for the qpdf QPDFJob::Config surface.

qpdf returns a shared Config object whose setters mutate the owning job and return the same proxy (include/qpdf/QPDFJob.hh:317-375). Rust expresses that lifetime as a mutable borrow, so the proxy cannot outlive the QPDFJob it configures and every setter remains on the canonical job state.

Implementations§

Source§

impl QPDFJobConfig<'_>

Source

pub fn copy_encryption( &mut self, path: impl Into<PathBuf>, password: impl Into<Vec<u8>>, ) -> &mut Self

Configure qpdf’s copy-encryption donor and the password used when it is opened during the write stage.

QPDFJob::Config::copyEncryption stores the donor filename and clears explicit encryption/decryption state; writeQPDF opens the donor only after createQPDF has completed (QPDFJob.cc:2891-2899). Keeping the filename on the job is also required by handlePageSpecs, which reuses encryptionFilePassword for a page specification with the same raw filename and no explicit password (QPDFJob.cc:2405-2410).

Source

pub fn clear_copy_encryption_for_writer(&mut self) -> &mut Self

Drop the writer side of a previous copy_encryption call while keeping the donor filename and password for page-specification authentication.

qpdf holds these separately: --decrypt and --encrypt clear only the copy_encryption flag that gates QPDFWriter::copyEncryptionParameters (libqpdf/QPDFJob_config.cc:155-157,1164-1166, applied at QPDFJob.cc:2891-2900), while encryption_file and encryption_file_password are never cleared and remain available to the page-specification password fallback at QPDFJob.cc:2405-2410.

Source

pub fn input_file( &mut self, input_file: impl Into<PathBuf>, ) -> Result<&mut Self>

Set the primary input filename, rejecting duplicate input selection.

Source

pub fn empty_input(&mut self) -> Result<&mut Self>

Select qpdf’s empty primary input.

This is QPDFJob::Config::emptyInput (libqpdf/QPDFJob_config.cc:27-40). Keep the explicit configuration bit separate from the empty document’s display description: QPDFJob::create_qpdf uses it to choose the emptyPDF creation path, while the resulting document is still named empty PDF for diagnostics. Like qpdf, selecting an empty input after an input file (or selecting it twice) is a usage error.

Source

pub fn output_file( &mut self, output_file: impl Into<PathBuf>, ) -> Result<&mut Self>

Set the output filename, rejecting duplicate output selection.

Source

pub fn replace_input(&mut self) -> Result<&mut Self>

Configure qpdf’s replaceInput output mode.

Source

pub fn json_input(&mut self) -> &mut Self

Configure qpdf’s jsonInput source mode.

Source

pub fn json(&mut self, version: i32) -> &mut Self

Select qpdf’s JSON output at the requested version.

This is QPDFJob::Config::json (libqpdf/QPDFJob_config.cc:253-265). qpdf parses and range-checks the version spelling inside the callback; the argv boundaries own that parse here, so this takes the parsed version. check_configuration then defaults the destination to standard output when no output file was given, and write_qpdf dispatches JSON output through writeOutfile’s destination rewrite.

Source

pub fn json_output(&mut self, version: i32) -> &mut Self

Select qpdf’s --json-output mode at the requested version.

This is QPDFJob::Config::jsonOutput (libqpdf/QPDFJob_config.cc:312-326): it selects JSON output, defaults stream data to inline and the decode level to none unless either was set explicitly, and adds the qpdf key.

Source

pub fn json_key(&mut self, key: JsonKey) -> &mut Self

Request one top-level qpdf JSON key.

This is QPDFJob::Config::jsonKey (libqpdf/QPDFJob_config.cc:267-272). qpdf keeps the keys in a std::set, so requesting the same key twice records it once.

Source

pub fn json_object(&mut self, selector: impl Into<String>) -> &mut Self

Retain one raw --json-object selector.

This is QPDFJob::Config::jsonObject (libqpdf/QPDFJob_config.cc:274-279). qpdf stores the spelling and parses it only while the object section is emitted (libqpdf/QPDFJob.cc:929-997).

Source

pub fn json_stream_data(&mut self, stream_data: JsonStreamData) -> &mut Self

Select how stream payloads appear in JSON output.

This is QPDFJob::Config::jsonStreamData (libqpdf/QPDFJob_config.cc:281-296), including the explicit-selection flag that keeps --json-output from defaulting the mode to inline. qpdf parses the spelling inside the callback; the argv boundaries own that parse here.

Source

pub fn json_stream_prefix(&mut self, prefix: impl Into<Vec<u8>>) -> &mut Self

Set the prefix for JSON stream side files.

This is QPDFJob::Config::jsonStreamPrefix (libqpdf/QPDFJob_config.cc:298-303).

Source

pub fn test_json_schema(&mut self) -> &mut Self

Validate generated JSON output against qpdf’s own schema.

This is QPDFJob::Config::testJsonSchema (libqpdf/QPDFJob_config.cc:335-340).

Source

pub fn decode_level(&mut self, decode_level: DecodeLevel) -> &mut Self

Set the stream decoding level used for JSON output.

This is QPDFJob::Config::decodeLevel (libqpdf/QPDFJob_config.cc:717-732), including the explicit-selection flag that keeps --json-output from defaulting the level to none. qpdf’s single m->decode_level serves both the writer and JSON output; flpdf carries the writer’s copy in the writer configuration, so this sets the JSON consumer’s level only.

Source

pub fn update_from_json(&mut self, path: impl Into<PathBuf>) -> &mut Self

Configure qpdf’s updateFromJson create-stage input.

Source

pub fn set_page_labels<I, S>(&mut self, specs: I) -> Result<&mut Self>
where I: IntoIterator<Item = S>, S: AsRef<[u8]>,

Configure qpdf’s setPageLabels option-table result.

Source

pub fn remove_page_labels(&mut self) -> &mut Self

Configure qpdf’s removePageLabels bare option.

Source

pub fn remove_restrictions(&mut self) -> &mut Self

Route qpdf’s document transformations through the canonical job stage.

Source

pub fn coalesce_contents(&mut self) -> &mut Self

Enable qpdf’s provider-backed page-content coalescing.

Source

pub fn check(&mut self) -> &mut Self

Select qpdf’s doInspection document-check branch.

Source

pub fn check_linearization(&mut self) -> &mut Self

Select qpdf’s linearization-check inspection branch.

Source

pub fn show_npages(&mut self) -> &mut Self

Select qpdf’s raw page-count inspection branch.

Source

pub fn show_pages(&mut self) -> &mut Self

Select qpdf’s page-list inspection branch.

Source

pub fn show_xref(&mut self) -> &mut Self

Select qpdf’s cross-reference inspection branch.

Source

pub fn show_linearization(&mut self) -> &mut Self

Select qpdf’s linearization-data inspection branch.

Source

pub fn show_encryption(&mut self) -> &mut Self

Select qpdf’s encryption-parameters inspection branch.

Source

pub fn list_attachments(&mut self) -> &mut Self

Select qpdf’s embedded-file listing inspection branch.

Source

pub fn show_attachment(&mut self, key: impl Into<Vec<u8>>) -> &mut Self

Select qpdf’s embedded-file extraction inspection branch.

Source

pub fn raw_stream_data(&mut self) -> &mut Self

Select raw stream output for qpdf’s object inspection branch.

Source

pub fn filtered_stream_data(&mut self) -> &mut Self

Select filtered stream output for qpdf’s object inspection branch.

Source

pub fn normalize_content(&mut self, value: bool) -> &mut Self

Configure qpdf’s job-level normalizeContent setting.

Source

pub fn generate_appearances(&mut self) -> &mut Self

Enable qpdf’s form-appearance generation phase.

Source

pub fn flatten_annotations(&mut self, mode: FlattenAnnotationsMode) -> &mut Self

Enable qpdf’s annotation flattening mode.

Source

pub fn flatten_rotation(&mut self) -> &mut Self

Enable qpdf’s page-rotation flattening phase.

Source

pub fn rotate(&mut self, parameter: impl AsRef<[u8]>) -> Result<&mut Self>

Queue one qpdf --rotate parameter for the create-stage rotation map.

qpdf’s public QPDFJob::Config::rotate delegates to the private parseRotationParameter helper and stores the result keyed by its raw page-range string (QPDFJob_config.cc:786-790, QPDFJob.cc:369-415). Keep the byte-preserving parameter at this Config boundary so direct argv and job-JSON callers share the same parser and last-write-wins map semantics.

Source

pub fn collate(&mut self, parameter: impl AsRef<[u8]>) -> Result<&mut Self>

Append qpdf’s collate page-group sizes.

This is QPDFJob::Config::collate (libqpdf/QPDFJob_config.cc:95-125). qpdf permits repeated calls and appends each call’s comma-separated values to one ordered vector; an empty parameter appends the default group size of one. Reuse the byte-oriented parser shared with the job JSON boundary so its unsigned-prefix and error behavior remains one canonical implementation.

Source

pub fn split_pages(&mut self, parameter: impl AsRef<[u8]>) -> Result<&mut Self>

Configure qpdf’s splitPages writer-stage dispatch.

qpdf’s Config stores the signed int produced by string_to_int and leaves the later split-pages conversion to the write path (QPDFJob_config.cc:597-609, QPDFJob.cc:3218-3240). Reuse the job parser here rather than narrowing the CLI value before the canonical writer sees it.

Source

pub fn remove_unreferenced_resources( &mut self, mode: RemoveUnreferencedResources, ) -> &mut Self

Configure qpdf’s resource-pruning policy for split-page output.

Plain rewrites do not consume this field; qpdf’s doSplitPages path does, after create-stage transformations have completed (QPDFJob.cc:2939-3027).

Source

pub fn externalize_inline_images(&mut self, min_bytes: usize) -> &mut Self

Configure qpdf’s inline-image externalization phase.

Source

pub fn set_externalize_inline_images(&mut self) -> &mut Self

Enable qpdf’s inline-image externalization flag without changing the separately configured iiMinBytes threshold.

Source

pub fn optimize_images( &mut self, options: ImageOptimizationOptions, ) -> &mut Self

Configure qpdf’s image optimization phase and its thresholds.

Source

pub fn set_optimize_images(&mut self) -> &mut Self

Enable qpdf’s image optimization flag without changing its thresholds or the inline-image policy already layered into the configuration.

Source

pub fn keep_inline_images(&mut self) -> &mut Self

Enable qpdf’s keepInlineImages option in the shared job configuration.

Source

pub fn ii_min_bytes(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>

Set qpdf’s unsigned iiMinBytes threshold at the configuration boundary.

Source

pub fn oi_min_width(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>

Set qpdf’s unsigned oiMinWidth threshold at the configuration boundary.

Source

pub fn oi_min_height(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>

Set qpdf’s unsigned oiMinHeight threshold at the configuration boundary.

Source

pub fn oi_min_area(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>

Set qpdf’s unsigned oiMinArea threshold at the configuration boundary.

Source

pub fn overlay( &mut self, path: impl Into<PathBuf>, password: impl Into<Vec<u8>>, from: PageRange, to: PageRange, repeat: Option<PageRange>, ) -> &mut Self

Queue an overlay source for qpdf’s create-stage underlay/overlay pass.

Source

pub fn underlay( &mut self, path: impl Into<PathBuf>, password: impl Into<Vec<u8>>, from: PageRange, to: PageRange, repeat: Option<PageRange>, ) -> &mut Self

Queue an underlay source for qpdf’s create-stage underlay/overlay pass.

Source

pub fn writer_configuration( &mut self, configuration: WriterConfiguration, ) -> &mut Self

Apply the canonical writer settings used by write_qpdf.

Source

pub fn add_page_spec( &mut self, file: impl Into<PathBuf>, range: &str, password: Option<Vec<u8>>, ) -> Result<&mut Self>

Queue one --pages file specification for QPDFJob::PagesConfig::pageSpec (QPDFJob_config.cc:963-969), which QPDFJob::handlePageSpecs later consumes (QPDFJob.cc:2359-2440). Multiple calls remain in the same Config pages group; a JSON pages group cannot be added before or after them, matching qpdf’s Config::pages() one-time guard (QPDFJob_config.cc:945-961).

range uses PageRange’s qpdf QUtil::parse_numrange grammar, including x exclusion groups. An empty string selects every page, matching qpdf’s 1-z default (QPDFJob.cc:2364-2372). password is optional so the qpdf null-password state remains distinct from an explicitly supplied empty password.

§Errors

Returns Error::Usage when range does not parse, matching the job-JSON path for the same field.

Source

pub fn add_attachment(&mut self, options: AttachmentAddOptions) -> &mut Self

Queue one --add-attachment file for QPDFJob::addAttachments (QPDFJob.cc:2044-2083).

Source

pub fn remove_attachment(&mut self, key: impl Into<Vec<u8>>) -> &mut Self

Queue one --remove-attachment key for the removal pass in QPDFJob::handleTransformations (QPDFJob.cc:2223-2233).

Source

pub fn copy_attachments_from( &mut self, path: impl Into<PathBuf>, password: impl Into<Vec<u8>>, prefix: impl Into<Vec<u8>>, ) -> &mut Self

Queue one --copy-attachments-from donor for QPDFJob::copyAttachments (QPDFJob.cc:2089-2135).

Source

pub fn qdf(&mut self) -> &mut Self

Request qpdf QDF output.

Source

pub fn deterministic_id(&mut self) -> &mut Self

Request qpdf deterministic trailer identifiers.

Source

pub fn object_streams(&mut self, mode: &str) -> Result<&mut Self>

Select qpdf’s object-stream policy.

Source

pub fn progress(&mut self) -> &mut Self

Request qpdf writer progress reporting.

Source

pub fn verbose(&mut self) -> &mut Self

Enable qpdf verbose diagnostics.

Source

pub fn show_object(&mut self, selector: &str) -> Result<&mut Self>

Select the qpdf object inspection target and make output optional.

Source

pub fn check_configuration(&mut self) -> Result<()>

Run the owning job’s qpdf configuration consistency checks.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for QPDFJobConfig<'a>

§

impl<'a> !Send for QPDFJobConfig<'a>

§

impl<'a> !Sync for QPDFJobConfig<'a>

§

impl<'a> !UnwindSafe for QPDFJobConfig<'a>

§

impl<'a> Freeze for QPDFJobConfig<'a>

§

impl<'a> Unpin for QPDFJobConfig<'a>

§

impl<'a> UnsafeUnpin for QPDFJobConfig<'a>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.