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.

Returns the size of this area.

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

Sets the size of this area.

Sets the width of this 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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.