diff options
author | Teddy Wing | 2019-11-01 21:47:46 +0100 |
---|---|---|
committer | Teddy Wing | 2019-11-01 21:47:46 +0100 |
commit | 2a6496c631faba7d5f8c69c514e8db9d5f0c0b35 (patch) | |
tree | 7792461ff1473b00473cc58cfb81dee88be98d33 /src/main.rs | |
parent | 95eba1ff9ca62395e7fae7b4f1f260abea66d40a (diff) | |
download | pdf-urls-2a6496c631faba7d5f8c69c514e8db9d5f0c0b35.tar.bz2 |
main: Move URL extraction code into lib.rs
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/src/main.rs b/src/main.rs index 4b2d541..3964551 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,38 +1,5 @@ -extern crate lopdf; - -use lopdf::{Document, Object}; +use pdf_urls::get_urls_from_pdf; fn main() { - let doc = Document::load("example.pdf").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()); - - () - }, - _ => (), - } - } - } - } - } - - () - }, - _ => (), - } - } + get_urls_from_pdf(); } |