From 4fc7fb12f68a996429a86c6b5145eea502c96138 Mon Sep 17 00:00:00 2001 From: Eli Flanagan Date: Tue, 25 Aug 2020 13:38:00 -0400 Subject: [PATCH] print document metadata values using as_str First step of #55. --- examples/metadata/src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/metadata/src/main.rs b/examples/metadata/src/main.rs index 2733af93..3a1015f3 100644 --- a/examples/metadata/src/main.rs +++ b/examples/metadata/src/main.rs @@ -11,7 +11,11 @@ fn main() -> Result<(), PdfError> { let file = File::>::open(&path).unwrap(); if let Some(ref info) = file.trailer.info_dict { - eprintln!("{:?}", info); + info.iter() + .filter(|(_, primitive)| primitive.as_str().is_some()) + .for_each(|(key, value)| { + eprintln!("{:>15}: {}", key, value.as_str().unwrap()); + }); } Ok(())