Struct printpdf::LinkAnnotation
source · pub struct LinkAnnotation {
pub rect: Rect,
pub border: BorderArray,
pub c: ColorArray,
pub a: Actions,
pub h: HighlightingMode,
}
Fields§
§rect: Rect
§border: BorderArray
§c: ColorArray
§a: Actions
§h: HighlightingMode
Implementations§
source§impl LinkAnnotation
impl LinkAnnotation
sourcepub fn new(
rect: Rect,
border: Option<BorderArray>,
c: Option<ColorArray>,
a: Actions,
h: Option<HighlightingMode>
) -> Self
pub fn new( rect: Rect, border: Option<BorderArray>, c: Option<ColorArray>, a: Actions, h: Option<HighlightingMode> ) -> Self
Creates a new LinkAnnotation
Examples found in repository?
examples/hyperlink.rs (lines 16-22)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() {
let (doc, page1, layer1) =
PdfDocument::new("printpdf graphics test", Mm(595.276), Mm(841.89), "Layer 1");
let current_layer = doc.get_page(page1).get_layer(layer1);
let text = "Lorem ipsum";
let font = doc.add_builtin_font(BuiltinFont::TimesBoldItalic).unwrap();
current_layer.use_text(text, 48.0, Mm(10.0), Mm(200.0), &font);
current_layer.add_link_annotation(LinkAnnotation::new(
printpdf::Rect::new(Mm(10.0), Mm(200.0), Mm(100.0), Mm(212.0)),
Some(printpdf::BorderArray::default()),
Some(printpdf::ColorArray::default()),
printpdf::Actions::uri("https://www.google.com/".to_string()),
Some(printpdf::HighlightingMode::Invert),
));
doc.save(&mut BufWriter::new(
File::create("test_hyperlink.pdf").unwrap(),
))
.unwrap();
}
Trait Implementations§
source§impl Clone for LinkAnnotation
impl Clone for LinkAnnotation
source§fn clone(&self) -> LinkAnnotation
fn clone(&self) -> LinkAnnotation
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for LinkAnnotation
impl Debug for LinkAnnotation
Auto Trait Implementations§
impl RefUnwindSafe for LinkAnnotation
impl Send for LinkAnnotation
impl Sync for LinkAnnotation
impl Unpin for LinkAnnotation
impl UnwindSafe for LinkAnnotation
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
Mutably borrows from an owned value. Read more