Skip to main content

PDPageContentStream

Struct PDPageContentStream 

Source
pub struct PDPageContentStream {
    pub mode: AppendMode,
    /* private fields */
}
Expand description

Content stream builder for rendering text, paths, graphics states and images on a page.

Fields§

§mode: AppendMode

Implementations§

Source§

impl PDPageContentStream

Source

pub fn new(mode: AppendMode) -> Self

Source

pub fn write_str(&mut self, s: &str)

Source

pub fn write_line(&mut self, s: &str)

Source

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

Source

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

Source

pub fn set_line_width(&mut self, width: f64) -> &mut Self

Source

pub fn set_line_cap(&mut self, cap: i32) -> &mut Self

Source

pub fn set_line_join(&mut self, join: i32) -> &mut Self

Source

pub fn set_stroke_color(&mut self, color: Color) -> &mut Self

Source

pub fn set_fill_color(&mut self, color: Color) -> &mut Self

Source

pub fn set_opacity_on_page( &mut self, page: &mut PDPage, stroke_alpha: f64, fill_alpha: f64, ) -> &mut Self

Source

pub fn set_opacity( &mut self, doc: &mut PDDocument, page_index: usize, stroke_alpha: f64, fill_alpha: f64, ) -> &mut Self

Source

pub fn transform( &mut self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64, ) -> &mut Self

Source

pub fn translate(&mut self, tx: f64, ty: f64) -> &mut Self

Source

pub fn scale(&mut self, sx: f64, sy: f64) -> &mut Self

Source

pub fn rotate(&mut self, degrees: f64, cx: f64, cy: f64) -> &mut Self

Source

pub fn move_to(&mut self, x: f64, y: f64) -> &mut Self

Source

pub fn line_to(&mut self, x: f64, y: f64) -> &mut Self

Source

pub fn curve_to( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64, ) -> &mut Self

Source

pub fn rect(&mut self, x: f64, y: f64, width: f64, height: f64) -> &mut Self

Source

pub fn circle(&mut self, cx: f64, cy: f64, r: f64) -> &mut Self

Source

pub fn round_rect( &mut self, x: f64, y: f64, w: f64, h: f64, r: f64, ) -> &mut Self

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn set_font(&mut self, font_name: &str, size: f64) -> &mut Self

Source

pub fn set_font_type1( &mut self, doc: &mut PDDocument, page_index: usize, font: PDType1Font, size: f64, ) -> &mut Self

Source

pub fn set_truetype_font( &mut self, doc: &mut PDDocument, page_index: usize, font: &PDTrueTypeFont, size: f64, ) -> &mut Self

Source

pub fn set_text_matrix( &mut self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64, ) -> &mut Self

Source

pub fn set_leading(&mut self, leading: f64) -> &mut Self

Source

pub fn move_text_position(&mut self, tx: f64, ty: f64) -> &mut Self

Source

pub fn show_text(&mut self, text: &str) -> &mut Self

Source

pub fn show_text_at(&mut self, text: &str, x: f64, y: f64) -> &mut Self

Source

pub fn show_text_multiline( &mut self, lines: &[&str], x: f64, y: f64, leading: f64, ) -> &mut Self

Source

pub fn draw_image( &mut self, image_name: &str, x: f64, y: f64, width: f64, height: f64, ) -> &mut Self

Source

pub fn finish(self, doc: &mut PDDocument, page_index: usize) -> PdfResult<()>

Flushes and applies the content stream to the document page.

Source

pub fn finish_to_bytes(self) -> Vec<u8> ⓘ

Returns the raw byte buffer of this content stream.

Auto Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V