Emit PDF link annotations from display lists
This commit is contained in:
1 parent
431bbd14d4
commit
da7f580bf0
4 files changed
+103
-2
No files matched your search
@@ -1334,6 +1334,28 @@ mod tests {
|
||||
assert_eq!(text.matches("/Type /Page ").count(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn link_rectangles_become_pdf_annotations() {
|
||||
use crate::render::DisplayList;
|
||||
let mut list = DisplayList {
|
||||
width: 612 * 65_536,
|
||||
height: 792 * 65_536,
|
||||
items: Vec::new(),
|
||||
images: Vec::new(),
|
||||
};
|
||||
list.link(
|
||||
72 * 65_536,
|
||||
700 * 65_536,
|
||||
100 * 65_536,
|
||||
12 * 65_536,
|
||||
"https://example.com/paper",
|
||||
);
|
||||
let pdf = crate::pdf::display_list_to_pdf(&list, 792 * 65_536);
|
||||
let text = String::from_utf8_lossy(&pdf);
|
||||
assert!(text.contains("/Subtype /Link"));
|
||||
assert!(text.contains("/A << /S /URI /URI (https://example.com/paper) >>"));
|
||||
assert!(text.contains("/Annots ["));
|
||||
}
|
||||
#[test]
|
||||
fn image_xobject_is_embedded_and_painted() {
|
||||
use crate::render::{DisplayItem, DisplayList, PdfImage};
|
||||
|
||||
Reference in new issue
Block a user