Struct genpdf::render::Area [−][src]
pub struct Area<'a> { /* fields omitted */ }
Expand description
A view on an area of a PDF layer that can be drawn on.
This struct 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
Reduces the size of the drawable area by the given margins.
Adds the given offset to the area, reducing the drawable area.
Sets the height of this area.
Splits this area horizontally using the given weights.
The returned vector has the same number of elements as the provided slice. The width of the i-th area is width * weights[i] / total_weight, where width is the width of this area, and total_weight is the sum of all given weights.
Inserts an image into the document.
Only available if the images
feature is enabled.
The position is assumed to be relative to the upper left hand corner of the area.
Your position will need to compensate for rotation/scale/dpi. Using Image
’s
render functionality will do this for you and is the recommended way to
insert an image into an Area.
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.
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
) -> Option<TextSection<'_, 'f, 'a>>
[src]
pub fn text_section<'f>(
&self,
font_cache: &'f FontCache,
position: Position,
style: Style
) -> Option<TextSection<'_, 'f, 'a>>
[src]Creates a new text section at the given position if the text section fits 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
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Area<'a>
impl<'a> !UnwindSafe for Area<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more