Struct printpdf::types::pdf_layer::PdfLayerReference
[−]
[src]
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)
Methods
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 does currently not work, because PDF does not
recognize unicode fonts, only builtin fonts done with
PDFDoc encoding
However, the function itself is valid
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_text<S>(&self, text: S, font: &IndirectFontRef) where
S: Into<String>,
[src]
S: Into<String>,
Sets the position where the text should appear (in mm)
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]
&self,
text: S,
font_size: i64,
x: Mm,
y: Mm,
font: &IndirectFontRef
) where
S: Into<String>,
Add text to the file, x and y are measure in millimeter from the bottom left corner
Trait Implementations
impl Debug for PdfLayerReference
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for PdfLayerReference
[src]
fn clone(&self) -> PdfLayerReference
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more