#[non_exhaustive]pub struct AnnotBorder {
pub width: f32,
pub style: AnnotBorderStyle,
pub dash: Option<[i64; 3]>,
}Expand description
Width and style for an annotation /BS dictionary.
Defaults match what Square and Ink wrote previously: width 2, solid.
use pdfrum_edit::{AnnotBorder, AnnotBorderStyle};
let border = AnnotBorder::default();
assert_eq!(border.width, 2.0);
assert_eq!(border.style, AnnotBorderStyle::Solid);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.width: f32Border width (/W) in points.
style: AnnotBorderStyleBorder style (/S).
dash: Option<[i64; 3]>Dash pattern /D as [on gap phase], for a AnnotBorderStyle::Dash
border.
None writes no /D, and a reader then falls back to its own default
of [3 0 0] — so a dashed border without this is dashed, just not to a
pattern the file states. The key is written only for a dashed style,
since it means nothing to the others.
Implementations§
Source§impl AnnotBorder
impl AnnotBorder
Sourcepub fn solid(width: f32) -> Self
pub fn solid(width: f32) -> Self
A solid border of the given width.
use pdfrum_edit::{AnnotBorder, AnnotBorderStyle};
let border = AnnotBorder::solid(1.5);
assert_eq!(border.width, 1.5);
assert_eq!(border.style, AnnotBorderStyle::Solid);Sourcepub fn with_style(self, style: AnnotBorderStyle) -> Self
pub fn with_style(self, style: AnnotBorderStyle) -> Self
Sets the style, keeping the current width.
Sourcepub fn with_dash(self, dash: [i64; 3]) -> Self
pub fn with_dash(self, dash: [i64; 3]) -> Self
Sets /D, the dash pattern, as [on gap phase].
Only a AnnotBorderStyle::Dash border writes it. The reader takes
the three entries as on-length, gap-length and phase, and an absent
/D as its own [3 0 0].
use pdfrum_edit::{AnnotBorder, AnnotBorderStyle};
let border = AnnotBorder::solid(1.0)
.with_style(AnnotBorderStyle::Dash)
.with_dash([4, 2, 0]);
assert_eq!(border.dash, Some([4, 2, 0]));Trait Implementations§
Source§impl Clone for AnnotBorder
impl Clone for AnnotBorder
Source§fn clone(&self) -> AnnotBorder
fn clone(&self) -> AnnotBorder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more