diff options
author | Teddy Wing | 2019-11-01 21:53:31 +0100 |
---|---|---|
committer | Teddy Wing | 2019-11-01 21:53:31 +0100 |
commit | 8a22a24b36a4f0d8c8225c23029b945bcc58619c (patch) | |
tree | fbb896fb07be0a9ff8d38defa58c4f87188156a6 | |
parent | 2a6496c631faba7d5f8c69c514e8db9d5f0c0b35 (diff) | |
download | pdf-urls-8a22a24b36a4f0d8c8225c23029b945bcc58619c.tar.bz2 |
get_urls_from_pdf: Take PDF path as an argument
-rw-r--r-- | src/lib.rs | 6 | ||||
-rw-r--r-- | src/main.rs | 5 |
2 files changed, 8 insertions, 3 deletions
@@ -1,9 +1,11 @@ extern crate lopdf; +use std::path::Path; + use lopdf::{Document, Object}; -pub fn get_urls_from_pdf() { - let doc = Document::load("example.pdf").unwrap(); +pub fn get_urls_from_pdf(path: &Path) { + let doc = Document::load(path).unwrap(); for (_, obj) in doc.objects { match obj { diff --git a/src/main.rs b/src/main.rs index 3964551..789e383 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,8 @@ +use std::path::Path; + use pdf_urls::get_urls_from_pdf; fn main() { - get_urls_from_pdf(); + let path = Path::new("example.pdf"); + get_urls_from_pdf(&path); } |