pub struct ContentInterpreter<'a> { /* private fields */ }Expand description
PDF content stream interpreter.
Implementations§
Source§impl<'a> ContentInterpreter<'a>
impl<'a> ContentInterpreter<'a>
Sourcepub fn new(
resolver: &'a Resolver<'a>,
resources: PdfDict,
initial_ctm: Matrix,
icc_cache: &IccCache,
font_provider: Option<FontProvider>,
overprint_enabled: bool,
ocg_off: &HashSet<u32>,
) -> Self
pub fn new( resolver: &'a Resolver<'a>, resources: PdfDict, initial_ctm: Matrix, icc_cache: &IccCache, font_provider: Option<FontProvider>, overprint_enabled: bool, ocg_off: &HashSet<u32>, ) -> Self
Create a new interpreter.
Sourcepub fn set_page_group_cmyk(&mut self)
pub fn set_page_group_cmyk(&mut self)
Mark this page as having a DeviceCMYK transparency group. DeviceRGB colors will be round-tripped through the ICC CMYK profile to match compositing in CMYK space (produces more muted, accurate colors).
Sourcepub fn set_pdfx_cmyk_intent(&mut self)
pub fn set_pdfx_cmyk_intent(&mut self)
Mark this document as declaring a PDF/X-style CMYK output intent. Opts
the document into the DeviceGray-to-K-only promotion required by GWG
23.0. Plain /Group /CS /DeviceCMYK pages should not call this.
Sourcepub fn interpret(self, data: &[u8]) -> Result<DisplayList, PdfError>
pub fn interpret(self, data: &[u8]) -> Result<DisplayList, PdfError>
Interpret a content stream and return the display list.
Sourcepub fn interpret_stream_public(&mut self, data: &[u8]) -> Result<(), PdfError>
pub fn interpret_stream_public(&mut self, data: &[u8]) -> Result<(), PdfError>
Interpret a content stream, keeping the interpreter alive for further use.
Sourcepub fn into_display_list(self) -> DisplayList
pub fn into_display_list(self) -> DisplayList
Consume the interpreter and return the display list.
Sourcepub fn unwind_gstate_stack(&mut self)
pub fn unwind_gstate_stack(&mut self)
Unwind any leftover gstate stack entries from unbalanced q/Q. Some PDFs have more q’s than Q’s; pop each entry as if Q were called, restoring clip state at each level so display list clips are correct.
Sourcepub fn reset_clip_for_annotations(&mut self)
pub fn reset_clip_for_annotations(&mut self)
Reset clip state before rendering annotations. This ensures annotations aren’t affected by clip regions from the page content.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ContentInterpreter<'a>
impl<'a> !Send for ContentInterpreter<'a>
impl<'a> !Sync for ContentInterpreter<'a>
impl<'a> !UnwindSafe for ContentInterpreter<'a>
impl<'a> Freeze for ContentInterpreter<'a>
impl<'a> Unpin for ContentInterpreter<'a>
impl<'a> UnsafeUnpin for ContentInterpreter<'a>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more