diff options
| author | Teddy Wing | 2019-10-30 22:16:22 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2019-10-30 22:16:22 +0100 | 
| commit | 612842e55541d112ae4dbf56d49a6026319d1165 (patch) | |
| tree | 3c29c147aa9af6dfbbf52eaba449aa5a24b27643 /src | |
| parent | bb634a8a68c575b0c7b3c93f772331c37594b785 (diff) | |
| download | pdf-urls-612842e55541d112ae4dbf56d49a6026319d1165.tar.bz2 | |
Inspect an example PDF file using the 'lopdf' crate
Walk the different objects in the PDF to discover how hyperlinks are
stored and how I can access them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 28 | 
1 files changed, 27 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..95a6d1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,29 @@ +extern crate lopdf; + +use lopdf::{Document, Object}; +  fn main() { -    println!("Hello, world!"); +    let doc = Document::load("example.pdf").unwrap(); +    // dbg!("{:?}", doc); + +    for (id, obj) in doc.objects { +        // dbg!(obj.as_dict().unwrap()); + +        match obj { +            // Object::String(bs, format) => { +            //     dbg!(bs, format); +            //     () +            // }, +            Object::Dictionary(d) => { +                // dbg!(d); + +                for (k, v) in d.iter() { +                    dbg!(::std::str::from_utf8(&k).unwrap(), v); +                } + +                () +            }, +            _ => (), +        } +    }  }  | 
