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§impl Debug for MarkupSpec
impl Debug for MarkupSpec
Source§impl From<MarkupSpec> for AnnotWrite
impl From<MarkupSpec> for AnnotWrite
Source§fn from(builder: MarkupSpec) -> Self
fn from(builder: MarkupSpec) -> Self
Source§impl From<MarkupSpec> for AnnotSpec
impl From<MarkupSpec> for AnnotSpec
Source§fn from(b: MarkupSpec) -> Self
fn from(b: MarkupSpec) -> Self
Source§impl PartialEq for MarkupSpec
impl PartialEq for MarkupSpec
impl StructuralPartialEq for MarkupSpec
Auto Trait Implementations§
impl Freeze for MarkupSpec
impl RefUnwindSafe for MarkupSpec
impl Send for MarkupSpec
impl Sync for MarkupSpec
impl Unpin for MarkupSpec
impl UnsafeUnpin for MarkupSpec
impl UnwindSafe for MarkupSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.