blob: 82e58fddd043b1cb0e8433f9a5f6c280d138a2c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
extern crate lopdf;
use std::path::Path;
use lopdf::{Document, Object};
pub fn get_urls_from_pdf(path: &Path) {
let doc = Document::load(path).unwrap();
for (_, obj) in doc.objects {
match obj {
Object::Dictionary(d) => {
for (k, v) in d.iter() {
let key = ::std::str::from_utf8(&k).unwrap();
if key == "A" {
for (k, v) in v.as_dict().unwrap() {
let key = ::std::str::from_utf8(&k).unwrap();
if key == "URI" {
match v {
Object::String(s, _) => {
println!("{}", ::std::str::from_utf8(s).unwrap());
()
},
_ => (),
}
}
}
}
}
()
},
_ => (),
}
}
}
|