Struct pdf_writer::writers::Annotation
source · pub struct Annotation<'a> { /* private fields */ }Expand description
Writer for an annotation dictionary.
An array of this struct is created by Page::annotations.
Implementations§
source§impl<'a> Annotation<'a>
impl<'a> Annotation<'a>
sourcepub fn subtype(&mut self, kind: AnnotationType) -> &mut Self
pub fn subtype(&mut self, kind: AnnotationType) -> &mut Self
Write the /Subtype attribute to tell the viewer the type of this
particular annotation.
sourcepub fn rect(&mut self, rect: Rect) -> &mut Self
pub fn rect(&mut self, rect: Rect) -> &mut Self
Write the /Rect attribute. This is the location and dimensions of the
annotation on the page.
sourcepub fn contents(&mut self, text: TextStr<'_>) -> &mut Self
pub fn contents(&mut self, text: TextStr<'_>) -> &mut Self
Write the /Contents attribute. This is the content or alt-text,
depending on the AnnotationType.
sourcepub fn name(&mut self, text: TextStr<'_>) -> &mut Self
pub fn name(&mut self, text: TextStr<'_>) -> &mut Self
Write the /NM attribute. This uniquely identifies the annotation on the
page. PDF 1.3+.
sourcepub fn modified(&mut self, date: Date) -> &mut Self
pub fn modified(&mut self, date: Date) -> &mut Self
Write the /M attribute, specifying the date the annotation was last
modified. PDF 1.1+.
sourcepub fn flags(&mut self, flags: AnnotationFlags) -> &mut Self
pub fn flags(&mut self, flags: AnnotationFlags) -> &mut Self
Write the /F attribute.
sourcepub fn border(
&mut self,
h_radius: f32,
v_radius: f32,
width: f32,
dash_pattern: Option<&[f32]>
) -> &mut Self
pub fn border( &mut self, h_radius: f32, v_radius: f32, width: f32, dash_pattern: Option<&[f32]> ) -> &mut Self
Write the /Border attribute. This describes the look of the border
around the annotation, including width and horizontal and vertical
border radii. The function may also receive a dash pattern which
specifies the lengths and gaps of the border segments on a dashed
border. Although all PDF versions accept /Border, this feature
specifically is only available in PDF 1.1 or later.
sourcepub fn border_style(&mut self) -> BorderStyle<'_>
pub fn border_style(&mut self) -> BorderStyle<'_>
Start writing the /BS attribute. These are some more elaborate border
settings taking precedence over /B for some annotation types. PDF 1.2+.
sourcepub fn color_transparent(&mut self) -> &mut Self
pub fn color_transparent(&mut self) -> &mut Self
Write the /C attribute forcing a transparent color. This sets the
annotations background color and its popup title bar color. PDF 1.1+.
sourcepub fn color_gray(&mut self, gray: f32) -> &mut Self
pub fn color_gray(&mut self, gray: f32) -> &mut Self
Write the /C attribute using a grayscale color. This sets the
annotations background color and its popup title bar color. PDF 1.1+.
sourcepub fn color_rgb(&mut self, r: f32, g: f32, b: f32) -> &mut Self
pub fn color_rgb(&mut self, r: f32, g: f32, b: f32) -> &mut Self
Write the /C attribute using an RGB color. This sets the annotations
background color and its popup title bar color. PDF 1.1+.
sourcepub fn color_cmyk(&mut self, c: f32, m: f32, y: f32, k: f32) -> &mut Self
pub fn color_cmyk(&mut self, c: f32, m: f32, y: f32, k: f32) -> &mut Self
Write the /C attribute using a CMYK color. This sets the annotations
background color and its popup title bar color. PDF 1.1+.
sourcepub fn struct_parent(&mut self, key: i32) -> &mut Self
pub fn struct_parent(&mut self, key: i32) -> &mut Self
Write the /StructParent attribute to indicate the structure tree
element this annotation belongs to. PDF 1.3+.
sourcepub fn action(&mut self) -> Action<'_>
pub fn action(&mut self) -> Action<'_>
Start writing the /A dictionary. Only permissible for the subtype
Link.
sourcepub fn highlight(&mut self, effect: HighlightEffect) -> &mut Self
pub fn highlight(&mut self, effect: HighlightEffect) -> &mut Self
Write the /H attribute to set what effect is used to convey that the
user is pressing a link annotation. Only permissible for the subtype
Link. PDF 1.2+.
Write the /T attribute. This is in the title bar of markup annotations
and should be the name of the annotation author. PDF 1.1+.
sourcepub fn subject(&mut self, text: TextStr<'_>) -> &mut Self
pub fn subject(&mut self, text: TextStr<'_>) -> &mut Self
Write the /Subj attribute. This is the subject of the annotation.
PDF 1.5+.
sourcepub fn quad_points(
&mut self,
coordinates: impl IntoIterator<Item = f32>
) -> &mut Self
pub fn quad_points( &mut self, coordinates: impl IntoIterator<Item = f32> ) -> &mut Self
Write the /QuadPoints attribute, specifying the region in which the
link should be activated. PDF 1.6+.
sourcepub fn line_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) -> &mut Self
pub fn line_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) -> &mut Self
Write the /L attribute. This defines the start and end point of a
line annotation
sourcepub fn file_spec(&mut self) -> FileSpec<'_>
pub fn file_spec(&mut self) -> FileSpec<'_>
Start writing the /FS attribute, setting which file to reference.
sourcepub fn icon(&mut self, icon: AnnotationIcon<'_>) -> &mut Self
pub fn icon(&mut self, icon: AnnotationIcon<'_>) -> &mut Self
Write the /Name attribute. Refer to the specification to see which
names are allowed for which annotation types.
Methods from Deref<Target = Dict<'a>>§
sourcepub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>
Start writing a pair with an arbitrary value.