Skip to main content

ContentInterpreter

Struct ContentInterpreter 

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

PDF content stream interpreter.

Implementations§

Source§

impl<'a> ContentInterpreter<'a>

Source

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.

Source

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).

Source

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.

Source

pub fn interpret(self, data: &[u8]) -> Result<DisplayList, PdfError>

Interpret a content stream and return the display list.

Source

pub fn interpret_stream_public(&mut self, data: &[u8]) -> Result<(), PdfError>

Interpret a content stream, keeping the interpreter alive for further use.

Source

pub fn into_display_list(self) -> DisplayList

Consume the interpreter and return the display list.

Source

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.

Source

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.

Source

pub fn render_annotation( &mut self, obj_num: u32, gen_num: u16, ) -> Result<(), PdfError>

Render an annotation’s normal appearance stream (/AP /N).

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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, <T as TryFrom<U>>::Error>

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.