Struct pdf_writer::writers::LayoutAttributes

source ·
pub struct LayoutAttributes<'a> { /* private fields */ }
Expand description

Writer for an layout attributes dictionary. PDF 1.4+

This struct is created by Attributes::layout.

Implementations§

source§

impl<'a> LayoutAttributes<'a>

General layout attributes.

source

pub fn placement(&mut self, placement: Placement) -> &mut Self

Write the /Placement attribute.

source

pub fn writing_mode(&mut self, mode: WritingMode) -> &mut Self

Write the /WritingMode attribute to set the writing direction.

source

pub fn background_color(&mut self, color: [f32; 3]) -> &mut Self

Write the /BackgroundColor attribute to set the background color in RGB between 0 and 1. PDF 1.5+

source

pub fn border_color(&mut self, color: [f32; 3]) -> &mut Self

Write the /BorderColor attribute.

source

pub fn border_style(&mut self, style: [LayoutBorderStyle; 4]) -> &mut Self

Write the /BorderStyle attribute.

source

pub fn border_thickness(&mut self, thickness: [f32; 4]) -> &mut Self

Write the /BorderThickness attribute.

source

pub fn padding(&mut self, padding: [f32; 4]) -> &mut Self

Write the /Padding attribute.

source

pub fn color(&mut self, color: [f32; 3]) -> &mut Self

Write the /Color attribute.

source§

impl LayoutAttributes<'_>

Block level elements.

source

pub fn space_before(&mut self, space: f32) -> &mut Self

Write the /SpaceBefore attribute.

source

pub fn space_after(&mut self, space: f32) -> &mut Self

Write the /SpaceAfter attribute.

source

pub fn start_indent(&mut self, indent: f32) -> &mut Self

Write the /StartIndent attribute.

source

pub fn end_indent(&mut self, indent: f32) -> &mut Self

Write the /EndIndent attribute.

source

pub fn text_indent(&mut self, indent: f32) -> &mut Self

Write the /TextIndent attribute.

source

pub fn text_align(&mut self, align: TextAlign) -> &mut Self

Write the /TextAlign attribute.

source

pub fn width(&mut self, width: f32) -> &mut Self

Write the /Width attribute for table row groups and illustrative elements. No intrinsic height will be assumed if left empty.

source

pub fn height(&mut self, height: f32) -> &mut Self

Write the /Height attribute for table row groups and illustrative elements. No intrinsic height will be assumed if left empty.

source§

impl LayoutAttributes<'_>

Illustration elements.

source

pub fn bbox(&mut self, bbox: Rect) -> &mut Self

Write the /BBox attribute.

source§

impl LayoutAttributes<'_>

Table header and data.

source

pub fn block_align(&mut self, align: BlockAlign) -> &mut Self

Write the /BlockAlign attribute.

source

pub fn inline_align(&mut self, align: InlineAlign) -> &mut Self

Write the /InlineAlign attribute.

source

pub fn table_border_style(&mut self, style: [LayoutBorderStyle; 4]) -> &mut Self

Write the /TBorderStyle attribute. PDF 1.5+.

source

pub fn table_padding(&mut self, padding: f32) -> &mut Self

Write the /TPadding attribute. PDF 1.5+.

source§

impl<'a> LayoutAttributes<'a>

Grouping elements.

source

pub fn column_count(&mut self, count: i32) -> &mut Self

Write the /ColumnCount attribute. PDF 1.6+.

source

pub fn column_widths(&mut self) -> TypedArray<'_, f32>

Start writing the /ColumnWidths array. The last number in the array is used for all extra columns. PDF 1.6+.

source

pub fn column_gap(&mut self) -> TypedArray<'_, f32>

Start writing the /ColumnGap array. The last number in the array is used for all extra columns. PDF 1.6+.

source§

impl LayoutAttributes<'_>

Inline elements.

source

pub fn line_height(&mut self, height: LineHeight) -> &mut Self

Write the /LineHeight attribute.

source

pub fn baseline_shift(&mut self, shift: f32) -> &mut Self

Write the /BaselineShift attribute.

source

pub fn text_decoration_type( &mut self, decoration: TextDecorationType ) -> &mut Self

Write the /TextDecorationType attribute. PDF 1.5+.

source

pub fn text_decoration_color(&mut self, color: [f32; 3]) -> &mut Self

Write the /TextDecorationColor attribute in RGB. PDF 1.5+.

source

pub fn text_decoration_thickness(&mut self, thickness: f32) -> &mut Self

Write the /TextDecorationThickness attribute. PDF 1.5+.

source§

impl LayoutAttributes<'_>

Vertical Text.

source

pub fn glyph_orientation_vertical(&mut self, angle: f32) -> &mut Self

Write the /GlyphOrientationVertical attribute as an angle between -90 and 360 in multiples of 90. PDF 1.5+.

source§

impl LayoutAttributes<'_>

Ruby annotations.

source

pub fn ruby_align(&mut self, align: RubyAlign) -> &mut Self

Write the /RubyAlign attribute. PDF 1.5+.

source

pub fn ruby_position(&mut self, position: RubyPosition) -> &mut Self

Write the /RubyPosition attribute. PDF 1.5+.

Methods from Deref<Target = Dict<'a>>§

source

pub fn len(&self) -> i32

The number of written pairs.

source

pub fn is_empty(&self) -> bool

Whether no pairs have been written so far.

source

pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>

Start writing a pair with an arbitrary value.

source

pub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self

Write a pair with a primitive value.

This is a shorthand for dict.insert(key).primitive(value).

source

pub fn pairs<'n, T: Primitive>( &mut self, pairs: impl IntoIterator<Item = (Name<'n>, T)> ) -> &mut Self

Write a sequence of pairs with primitive values.

Trait Implementations§

source§

impl<'a> Deref for LayoutAttributes<'a>

§

type Target = Dict<'a>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for LayoutAttributes<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a, 'any> Rewrite<'a> for LayoutAttributes<'any>

§

type Output = LayoutAttributes<'a>

The writer with the rewritten lifetime.
source§

impl<'a> Writer<'a> for LayoutAttributes<'a>

source§

fn start(obj: Obj<'a>) -> Self

Start writing the object.

Auto Trait Implementations§

§

impl<'a> Freeze for LayoutAttributes<'a>

§

impl<'a> RefUnwindSafe for LayoutAttributes<'a>

§

impl<'a> Send for LayoutAttributes<'a>

§

impl<'a> Sync for LayoutAttributes<'a>

§

impl<'a> Unpin for LayoutAttributes<'a>

§

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

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Finish for T

source§

fn finish(self)

Does nothing but move self, equivalent to drop.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.