pub struct MarkupSpec { /* private fields */ }Expand description
A text-markup annotation: Highlight, Underline, StrikeOut, or Squiggly.
The four share a shape — a colour and a set of /QuadPoints — so one
builder covers them and MarkupKind picks the subtype.
use kurbo::Rect;
use peniko::Color;
use pdfrum_edit::{AnnotSpec, MarkupKind, MarkupSpec};
let rect = Rect::new(0.0, 0.0, 80.0, 12.0);
let spec: AnnotSpec = MarkupSpec::new(MarkupKind::Highlight, rect, Color::from_rgb8(255, 255, 0))
.quads([rect.into()])
.contents("note")
.into();Implementations§
Source§impl MarkupSpec
impl MarkupSpec
Sourcepub fn new(kind: MarkupKind, rect: Rect, color: Color) -> Self
pub fn new(kind: MarkupKind, rect: Rect, color: Color) -> Self
A markup annotation covering rect as a single quadrilateral.
Replace the geometry with MarkupSpec::quads to mark up a
selection of several runs.
Sourcepub fn quads(self, quads: impl IntoIterator<Item = Quad>) -> Self
pub fn quads(self, quads: impl IntoIterator<Item = Quad>) -> Self
Replaces the /QuadPoints, one quadrilateral per marked run.
Writing a spec whose quads are empty fails with
crate::Error::EmptyQuadPoints. pdfrum_text::rects_loose gives
the em-box rectangles Acrobat marks up.
Source§impl MarkupSpec
impl MarkupSpec
Sourcepub fn contents(self, contents: impl Into<String>) -> Self
pub fn contents(self, contents: impl Into<String>) -> Self
A text-markup annotation.
Sets /Contents.
A text-markup annotation.
Sets /T, the author.
Sourcepub fn name(self, name: impl Into<String>) -> AnnotWrite
pub fn name(self, name: impl Into<String>) -> AnnotWrite
A text-markup annotation.
Sets /NM, the annotation’s unique name.
Sourcepub fn modified(self, modified: impl Into<String>) -> AnnotWrite
pub fn modified(self, modified: impl Into<String>) -> AnnotWrite
A text-markup annotation.
Sets /M, the modification date.
Sourcepub fn flags(self, flags: AnnotFlags) -> AnnotWrite
pub fn flags(self, flags: AnnotFlags) -> AnnotWrite
A text-markup annotation.
Sets /F, the annotation flags.
Sourcepub fn meta(self, meta: AnnotMeta) -> AnnotWrite
pub fn meta(self, meta: AnnotMeta) -> AnnotWrite
A text-markup annotation.
Sets every metadata field at once.
Trait Implementations§
Source§impl Clone for MarkupSpec
impl Clone for MarkupSpec
Source§fn clone(&self) -> MarkupSpec
fn clone(&self) -> MarkupSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more