pub struct Annotation<'a> { /* private fields */ }
Expand description
Writer for an annotation dictionary.
An array of this struct is created by Chunk::annotation
.
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 page(&mut self, id: Ref) -> &mut Self
pub fn page(&mut self, id: Ref) -> &mut Self
Write the /P
attribute. This provides an indirect reference to the
page object with which this annotation is associated. Required for the
subtype Screen
associated with rendition actions. PDF 1.3+.
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.
Required for all annotations in PDF/A except for Popup
.
sourcepub fn appearance(&mut self) -> Appearance<'_>
pub fn appearance(&mut self) -> Appearance<'_>
Start writing the /AP
dictionary to set how the annotation shall
be presented visually. If this dictionary contains sub dictionaries,
Self::appearance_state
must be set. PDF 1.2+.
Required for many annotations in PDF/A.
sourcepub fn appearance_state(&mut self, name: Name<'_>) -> &mut Self
pub fn appearance_state(&mut self, name: Name<'_>) -> &mut Self
Write the /AS
attribute to set the annotation’s current appearance
state from the /AP
subdictionary. Must be set if Self::appearance
has one or more subdictionaries. PDF 1.2+.
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 subtypes
Link
and Widget
.
Note that this attribute is forbidden in PDF/A.
sourcepub fn additional_actions(&mut self) -> AdditionalActions<'_>
pub fn additional_actions(&mut self) -> AdditionalActions<'_>
Start writing the /AA
dictionary. Only permissible for the subtype
Widget
. PDF 1.3+.
Note that this attribute is forbidden in PDF/A.
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 or widget annotation. Only permissible for the
subtypes Link
and Widget
. 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.
sourcepub fn appearance_characteristics(&mut self) -> AppearanceCharacteristics<'_>
pub fn appearance_characteristics(&mut self) -> AppearanceCharacteristics<'_>
Start writing the /MK
dictionary. Only permissible for the subtype
Widget
.
sourcepub fn parent(&mut self, id: Ref) -> &mut Self
pub fn parent(&mut self, id: Ref) -> &mut Self
Write the /Parent
attribute. Only permissible for the subtype
Widget
.
sourcepub fn associated_files(&mut self) -> TypedArray<'_, FileSpec<'_>>
pub fn associated_files(&mut self) -> TypedArray<'_, FileSpec<'_>>
Start writing the /AF
array to specify the associated files of the
annotation. PDF 2.0+ or PDF/A-3.
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.
sourcepub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self
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)
.
sourcepub fn pairs<'n, T: Primitive>(
&mut self,
pairs: impl IntoIterator<Item = (Name<'n>, T)>,
) -> &mut Self
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.