[][src]Struct printpdf::types::pdf_layer::PdfLayerReference

pub struct PdfLayerReference {
    pub document: Weak<RefCell<PdfDocument>>,
    pub page: PdfPageIndex,
    pub layer: PdfLayerIndex,
}

A "reference" to the current layer, allows for inner mutability but only inside this library

Fields

document: Weak<RefCell<PdfDocument>>

A weak reference to the document, for inner mutability

page: PdfPageIndex

The index of the page this layer is on

layer: PdfLayerIndex

The index of the layer this layer has (inside the page)

Implementations

impl PdfLayerReference[src]

pub fn add_shape(&self, line: Line)[src]

Add a shape to the layer. Use closed to indicate whether the line is a closed line Use has_fill to determine if the line should be filled.

pub fn begin_text_section(&self)[src]

Begins a new text section You have to make sure to call end_text_section afterwards

pub fn end_text_section(&self)[src]

Ends a new text section Only valid if begin_text_section has been called

pub fn set_fill_color(&self, fill_color: Color)[src]

Set the current fill color for the layer

pub fn set_font(&self, font: &IndirectFontRef, font_size: i64)[src]

Set the current font, only valid in a begin_text_section to end_text_section block

pub fn set_outline_color(&self, color: Color)[src]

Set the current line / outline color for the layer

pub fn set_overprint_fill(&self, overprint: bool)[src]

Set the overprint mode of the stroke color to true (overprint) or false (no overprint)

pub fn set_overprint_stroke(&self, overprint: bool)[src]

Set the overprint mode of the fill color to true (overprint) or false (no overprint) This changes the graphics state of the current page, don't do it too often or you'll bloat the file size

pub fn set_blend_mode(&self, blend_mode: BlendMode)[src]

Set the overprint mode of the fill color to true (overprint) or false (no overprint) This changes the graphics state of the current page, don't do it too often or you'll bloat the file size

pub fn set_outline_thickness(&self, outline_thickness: f64)[src]

Set the current line thickness, in points

NOTE: 0.0 is a special value, it does not make the line disappear, but rather makes it appear 1px wide across all devices

pub fn set_line_join_style(&self, line_join: LineJoinStyle)[src]

Set the current line join style for outlines

pub fn set_line_cap_style(&self, line_cap: LineCapStyle)[src]

Set the current line join style for outlines

pub fn set_line_dash_pattern(&self, dash_pattern: LineDashPattern)[src]

Set the current line join style for outlines

pub fn set_ctm(&self, ctm: CurTransMat)[src]

Sets (adds to) the current transformation matrix Use save_graphics_state() and restore_graphics_state() to "scope" the transformation matrix to a specific function

pub fn set_text_matrix(&self, tm: TextMatrix)[src]

Sets (replaces) the current text matrix This does not have to be scoped, since the matrix is replaced instead of concatenated to the current matrix. However, you should only call this function with in a block scoped by begin_text_section() and end_text_section()

pub fn set_text_cursor(&self, x: Mm, y: Mm)[src]

Sets the position where the text should appear

pub fn add_line_break(&self)[src]

If called inside a text block scoped by begin_text_section and end_text_section, moves the cursor to a new line. PDF does not have any concept of "alignment" except left-aligned text Note: Use set_line_height earlier to set the line height first

pub fn set_line_height(&self, height: i64)[src]

Sets the text line height inside a text block (must be called within begin_text_block and end_text_block)

pub fn set_character_spacing(&self, spacing: i64)[src]

Sets the character spacing inside a text block Values are given in points. A value of 3 (pt) will increase the spacing inside a word by 3pt.

pub fn set_word_spacing(&self, spacing: i64)[src]

Sets the word spacing inside a text block. Same as set_character_spacing, just for words. Note: This currently does not work for external fonts. External fonts are encoded with Unicode, and PDF does not recognize unicode fonts. It only recognizes builtin fonts done with PDFDoc encoding. However, the function itself is valid and will work with builtin fonts.

pub fn set_text_scaling(&self, scaling: i64)[src]

Sets the horizontal scaling (like a "condensed" font) Default value is 100 (regular scaling). Setting it to 50 will reduce the width of the written text by half, but stretch the text

pub fn set_line_offset(&self, offset: i64)[src]

Offsets the current text positon (used for superscript and subscript). To reset the superscript / subscript, call this function with 0 as the offset. For superscript, use a positive number, for subscript, use a negative number. This does not change the size of the font

pub fn set_text_rendering_mode(&self, mode: TextRenderingMode)[src]

pub fn write_codepoints<I>(&self, codepoints: I) where
    I: IntoIterator<Item = u16>, 
[src]

Add text to the file at the current position by specifying font codepoints for an ExternalFont

pub fn write_positioned_codepoints<I>(&self, codepoints: I) where
    I: IntoIterator<Item = (i64, u16)>, 
[src]

Add text to the file at the current position by specifying font codepoints with additional kerning offset

pub fn write_text<S>(&self, text: S, font: &IndirectFontRef) where
    S: Into<String>, 
[src]

Add text to the file at the current position

If the given font is a built-in font and the given text contains characters that are not supported by the Windows-1252 encoding, these characters will be ignored.

pub fn save_graphics_state(&self)[src]

Saves the current graphic state

pub fn restore_graphics_state(&self)[src]

Restores the previous graphic state

pub fn use_text<S>(
    &self,
    text: S,
    font_size: i64,
    x: Mm,
    y: Mm,
    font: &IndirectFontRef
) where
    S: Into<String>, 
[src]

Add text to the file, x and y are measure in millimeter from the bottom left corner

If the given font is a built-in font and the given text contains characters that are not supported by the Windows-1252 encoding, these characters will be ignored.

Trait Implementations

impl Clone for PdfLayerReference[src]

impl Debug for PdfLayerReference[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.