[][src]Struct genpdf::render::Area

pub struct Area<'a> { /* fields omitted */ }

A view on an area of a PDF layer that can be drawn on.

This page provides access to the drawing methods of a printpdf::PdfLayerReference. It is defined by the layer that is drawn on and the origin and the size of the area.

Implementations

impl<'a> Area<'a>[src]

pub fn add_margins(&mut self, margins: impl Into<Margins>)[src]

Reduces the size of the drawable area by the given margins.

pub fn size(&self) -> Size[src]

Returns the size of this area.

pub fn add_offset(&mut self, offset: impl Into<Position>)[src]

Adds the given offset to the area, reducing the drawable area.

pub fn set_size(&mut self, size: impl Into<Size>)[src]

Sets the size of this area.

pub fn set_width(&mut self, width: Mm)[src]

Sets the width of this area.

pub fn draw_line(&self, points: Vec<Position>, style: Style)[src]

Draws a line with the given points and the given style.

Currently, this method only uses the color of the given style as the outline color (if set). The points are relative to the upper left corner of the area.

pub fn print_str<S: AsRef<str>>(
    &self,
    font_cache: &FontCache,
    position: Position,
    style: Style,
    s: S
) -> bool
[src]

Tries to draw the given string at the given position and returns true if the area was large enough to draw the string.

The font cache must contain the PDF font for the font set in the style. The position is relative to the upper left corner of the area.

pub fn text_section<'f>(
    &self,
    font_cache: &'f FontCache,
    position: Position,
    style: Style
) -> Result<TextSection<'_, 'f, 'a>, ()>
[src]

Creates a new text section at the given position or returns an error if the text section does not fit in this area.

The given style is only used to calculate the line height of the section. The position is relative to the upper left corner of the area. The font cache must contain the PDF font for all fonts printed with the text section.

Trait Implementations

impl<'a> Clone for Area<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Area<'a>

impl<'a> !Send for Area<'a>

impl<'a> !Sync for Area<'a>

impl<'a> Unpin for Area<'a>

impl<'a> !UnwindSafe for Area<'a>

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.