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<'_>
impl QPDFJobConfig<'_>
Sourcepub fn copy_encryption(
&mut self,
path: impl Into<PathBuf>,
password: impl Into<Vec<u8>>,
) -> &mut Self
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).
Sourcepub fn clear_copy_encryption_for_writer(&mut self) -> &mut Self
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.
Sourcepub fn input_file(
&mut self,
input_file: impl Into<PathBuf>,
) -> Result<&mut Self>
pub fn input_file( &mut self, input_file: impl Into<PathBuf>, ) -> Result<&mut Self>
Set the primary input filename, rejecting duplicate input selection.
Sourcepub fn empty_input(&mut self) -> Result<&mut Self>
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.
Sourcepub fn output_file(
&mut self,
output_file: impl Into<PathBuf>,
) -> Result<&mut Self>
pub fn output_file( &mut self, output_file: impl Into<PathBuf>, ) -> Result<&mut Self>
Set the output filename, rejecting duplicate output selection.
Sourcepub fn replace_input(&mut self) -> Result<&mut Self>
pub fn replace_input(&mut self) -> Result<&mut Self>
Configure qpdf’s replaceInput output mode.
Sourcepub fn json_input(&mut self) -> &mut Self
pub fn json_input(&mut self) -> &mut Self
Configure qpdf’s jsonInput source mode.
Sourcepub fn json(&mut self, version: i32) -> &mut Self
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.
Sourcepub fn json_output(&mut self, version: i32) -> &mut Self
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.
Sourcepub fn json_key(&mut self, key: JsonKey) -> &mut Self
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.
Sourcepub fn json_object(&mut self, selector: impl Into<String>) -> &mut Self
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).
Sourcepub fn json_stream_data(&mut self, stream_data: JsonStreamData) -> &mut Self
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.
Sourcepub fn json_stream_prefix(&mut self, prefix: impl Into<Vec<u8>>) -> &mut Self
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).
Sourcepub fn test_json_schema(&mut self) -> &mut Self
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).
Sourcepub fn decode_level(&mut self, decode_level: DecodeLevel) -> &mut Self
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.
Sourcepub fn update_from_json(&mut self, path: impl Into<PathBuf>) -> &mut Self
pub fn update_from_json(&mut self, path: impl Into<PathBuf>) -> &mut Self
Configure qpdf’s updateFromJson create-stage input.
Sourcepub fn set_page_labels<I, S>(&mut self, specs: I) -> Result<&mut Self>
pub fn set_page_labels<I, S>(&mut self, specs: I) -> Result<&mut Self>
Configure qpdf’s setPageLabels option-table result.
Sourcepub fn remove_page_labels(&mut self) -> &mut Self
pub fn remove_page_labels(&mut self) -> &mut Self
Configure qpdf’s removePageLabels bare option.
Sourcepub fn remove_restrictions(&mut self) -> &mut Self
pub fn remove_restrictions(&mut self) -> &mut Self
Route qpdf’s document transformations through the canonical job stage.
Sourcepub fn coalesce_contents(&mut self) -> &mut Self
pub fn coalesce_contents(&mut self) -> &mut Self
Enable qpdf’s provider-backed page-content coalescing.
Sourcepub fn check_linearization(&mut self) -> &mut Self
pub fn check_linearization(&mut self) -> &mut Self
Select qpdf’s linearization-check inspection branch.
Sourcepub fn show_npages(&mut self) -> &mut Self
pub fn show_npages(&mut self) -> &mut Self
Select qpdf’s raw page-count inspection branch.
Sourcepub fn show_pages(&mut self) -> &mut Self
pub fn show_pages(&mut self) -> &mut Self
Select qpdf’s page-list inspection branch.
Sourcepub fn show_linearization(&mut self) -> &mut Self
pub fn show_linearization(&mut self) -> &mut Self
Select qpdf’s linearization-data inspection branch.
Sourcepub fn show_encryption(&mut self) -> &mut Self
pub fn show_encryption(&mut self) -> &mut Self
Select qpdf’s encryption-parameters inspection branch.
Sourcepub fn list_attachments(&mut self) -> &mut Self
pub fn list_attachments(&mut self) -> &mut Self
Select qpdf’s embedded-file listing inspection branch.
Sourcepub fn show_attachment(&mut self, key: impl Into<Vec<u8>>) -> &mut Self
pub fn show_attachment(&mut self, key: impl Into<Vec<u8>>) -> &mut Self
Select qpdf’s embedded-file extraction inspection branch.
Sourcepub fn raw_stream_data(&mut self) -> &mut Self
pub fn raw_stream_data(&mut self) -> &mut Self
Select raw stream output for qpdf’s object inspection branch.
Sourcepub fn filtered_stream_data(&mut self) -> &mut Self
pub fn filtered_stream_data(&mut self) -> &mut Self
Select filtered stream output for qpdf’s object inspection branch.
Sourcepub fn normalize_content(&mut self, value: bool) -> &mut Self
pub fn normalize_content(&mut self, value: bool) -> &mut Self
Configure qpdf’s job-level normalizeContent setting.
Sourcepub fn generate_appearances(&mut self) -> &mut Self
pub fn generate_appearances(&mut self) -> &mut Self
Enable qpdf’s form-appearance generation phase.
Sourcepub fn flatten_annotations(&mut self, mode: FlattenAnnotationsMode) -> &mut Self
pub fn flatten_annotations(&mut self, mode: FlattenAnnotationsMode) -> &mut Self
Enable qpdf’s annotation flattening mode.
Sourcepub fn flatten_rotation(&mut self) -> &mut Self
pub fn flatten_rotation(&mut self) -> &mut Self
Enable qpdf’s page-rotation flattening phase.
Sourcepub fn rotate(&mut self, parameter: impl AsRef<[u8]>) -> Result<&mut Self>
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.
Sourcepub fn collate(&mut self, parameter: impl AsRef<[u8]>) -> Result<&mut Self>
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.
Sourcepub fn split_pages(&mut self, parameter: impl AsRef<[u8]>) -> Result<&mut Self>
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.
Sourcepub fn remove_unreferenced_resources(
&mut self,
mode: RemoveUnreferencedResources,
) -> &mut Self
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).
Sourcepub fn externalize_inline_images(&mut self, min_bytes: usize) -> &mut Self
pub fn externalize_inline_images(&mut self, min_bytes: usize) -> &mut Self
Configure qpdf’s inline-image externalization phase.
Sourcepub fn set_externalize_inline_images(&mut self) -> &mut Self
pub fn set_externalize_inline_images(&mut self) -> &mut Self
Enable qpdf’s inline-image externalization flag without changing the
separately configured iiMinBytes threshold.
Sourcepub fn optimize_images(
&mut self,
options: ImageOptimizationOptions,
) -> &mut Self
pub fn optimize_images( &mut self, options: ImageOptimizationOptions, ) -> &mut Self
Configure qpdf’s image optimization phase and its thresholds.
Sourcepub fn set_optimize_images(&mut self) -> &mut Self
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.
Sourcepub fn keep_inline_images(&mut self) -> &mut Self
pub fn keep_inline_images(&mut self) -> &mut Self
Enable qpdf’s keepInlineImages option in the shared job configuration.
Sourcepub fn ii_min_bytes(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
pub fn ii_min_bytes(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
Set qpdf’s unsigned iiMinBytes threshold at the configuration boundary.
Sourcepub fn oi_min_width(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
pub fn oi_min_width(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
Set qpdf’s unsigned oiMinWidth threshold at the configuration boundary.
Sourcepub fn oi_min_height(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
pub fn oi_min_height(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
Set qpdf’s unsigned oiMinHeight threshold at the configuration boundary.
Sourcepub fn oi_min_area(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
pub fn oi_min_area(&mut self, value: impl AsRef<[u8]>) -> Result<&mut Self>
Set qpdf’s unsigned oiMinArea threshold at the configuration boundary.
Sourcepub fn overlay(
&mut self,
path: impl Into<PathBuf>,
password: impl Into<Vec<u8>>,
from: PageRange,
to: PageRange,
repeat: Option<PageRange>,
) -> &mut Self
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.
Sourcepub fn underlay(
&mut self,
path: impl Into<PathBuf>,
password: impl Into<Vec<u8>>,
from: PageRange,
to: PageRange,
repeat: Option<PageRange>,
) -> &mut Self
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.
Sourcepub fn writer_configuration(
&mut self,
configuration: WriterConfiguration,
) -> &mut Self
pub fn writer_configuration( &mut self, configuration: WriterConfiguration, ) -> &mut Self
Apply the canonical writer settings used by write_qpdf.
Sourcepub fn add_page_spec(
&mut self,
file: impl Into<PathBuf>,
range: &str,
password: Option<Vec<u8>>,
) -> Result<&mut Self>
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.
Sourcepub fn add_attachment(&mut self, options: AttachmentAddOptions) -> &mut Self
pub fn add_attachment(&mut self, options: AttachmentAddOptions) -> &mut Self
Queue one --add-attachment file for QPDFJob::addAttachments
(QPDFJob.cc:2044-2083).
Sourcepub fn remove_attachment(&mut self, key: impl Into<Vec<u8>>) -> &mut Self
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).
Sourcepub fn copy_attachments_from(
&mut self,
path: impl Into<PathBuf>,
password: impl Into<Vec<u8>>,
prefix: impl Into<Vec<u8>>,
) -> &mut Self
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).
Sourcepub fn deterministic_id(&mut self) -> &mut Self
pub fn deterministic_id(&mut self) -> &mut Self
Request qpdf deterministic trailer identifiers.
Sourcepub fn object_streams(&mut self, mode: &str) -> Result<&mut Self>
pub fn object_streams(&mut self, mode: &str) -> Result<&mut Self>
Select qpdf’s object-stream policy.
Sourcepub fn show_object(&mut self, selector: &str) -> Result<&mut Self>
pub fn show_object(&mut self, selector: &str) -> Result<&mut Self>
Select the qpdf object inspection target and make output optional.
Sourcepub fn check_configuration(&mut self) -> Result<()>
pub fn check_configuration(&mut self) -> Result<()>
Run the owning job’s qpdf configuration consistency checks.