pub struct PdfDevice { /* private fields */ }Expand description
PDF output device. Accumulates display lists per page and generates
a single PDF file containing all pages on finish().
Implementations§
Source§impl PdfDevice
impl PdfDevice
Sourcepub fn new(width: u32, height: u32, dpi: f64) -> Self
pub fn new(width: u32, height: u32, dpi: f64) -> Self
Create a new PDF device with the given page dimensions and DPI.
Sourcepub fn set_emit_page_box_clip(&mut self, on: bool)
pub fn set_emit_page_box_clip(&mut self, on: bool)
Control whether to emit the implicit 0 0 W H re W n page-box clip
at the top of each content stream. Default true; PDF→PDF round-trip
should set this to false so the writer faithfully reproduces the
source content without injecting a top-level clip.
Sourcepub fn set_output_intents(&mut self, intents: Vec<OutputIntentRecord>)
pub fn set_output_intents(&mut self, intents: Vec<OutputIntentRecord>)
Set the /Catalog /OutputIntents chain to emit. Replaces any
previously installed records. Used by PDF→PDF round-trip to carry
the source PDF’s PDF/X / PDF/A OutputIntent over to the output;
preserving this lets the renderer route DeviceGray / DeviceCMYK /
ICCBased fills through the same destination profile the source
declared, so a re-rendered output PDF colour-matches the input.
Sourcepub fn set_trim_box(&mut self, llx: f64, lly: f64, urx: f64, ury: f64)
pub fn set_trim_box(&mut self, llx: f64, lly: f64, urx: f64, ury: f64)
Set the trim box for the next page (in PDF points, lower-left origin).
Sourcepub fn set_page_size(&mut self, width: u32, height: u32)
pub fn set_page_size(&mut self, width: u32, height: u32)
Set the page dimensions used for the next page. The PS interpreter
path drives this implicitly through setpagedevice + device-factory
re-creation; direct API users (e.g. PDF→PDF rewriting) call this
before each replay_and_show so per-page sizes can vary across
pages in the same output PDF.
Sourcepub fn set_output_profile(&mut self, bytes: Vec<u8>)
👎Deprecated: OutputIntent emission is temporarily disabled pending PDF/X-4 support; calling this has no effect
pub fn set_output_profile(&mut self, bytes: Vec<u8>)
OutputIntent emission is temporarily disabled pending PDF/X-4 support; calling this has no effect
Set an ICC output profile.
Previously embedded as a PDF/X-3 OutputIntent, but the emitted output contained transparency features (soft masks) that PDF/X-3 prohibits. The OutputIntent emission path has been removed pending a correct PDF/X-4 implementation; calling this currently has no effect on the output. The setter is retained so the API is forward-compatible with the eventual X-4 work.
Sourcepub fn take_pdf_bytes(&self) -> Option<Vec<u8>>
pub fn take_pdf_bytes(&self) -> Option<Vec<u8>>
Build the PDF document into a byte vector.
Returns the complete PDF file contents. The device must have at least
one page (call after finish() or finish_with_context()).
Sourcepub fn take_pdf_bytes_with_context(&self, ctx: &Context) -> Option<Vec<u8>>
pub fn take_pdf_bytes_with_context(&self, ctx: &Context) -> Option<Vec<u8>>
Build the PDF document into a byte vector, using Context for font data.
Sourcepub fn set_output_path(&mut self, path: impl Into<String>)
pub fn set_output_path(&mut self, path: impl Into<String>)
Pin the file this device writes at end of job.
Set from an explicit --output path so the name is used verbatim,
instead of being derived in Self::replay_and_show from the
per-page name the interpreter passes down.
Trait Implementations§
Source§impl OutputDevice for PdfDevice
impl OutputDevice for PdfDevice
Source§fn writes_file_per_page(&self) -> bool
fn writes_file_per_page(&self) -> bool
Every page accumulates into one PDF, written at end of job, so a single output name serves a multi-page document.