pdf-rs/pdf

Cannot open file: Neither Kids nor Names present in NameTree node

jakewilliami opened this issue · 3 comments

I'm getting the following error when I am trying to load the file paper.pdf:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Try { file: "/Users/jakewilliami/.cargo/registry/src/github.com-1ecc6299db9ec823/pdf-0.8.0/src/file.rs", line: 324, column: 23, context: Context([]), source: FromPrimitive { typ: "RcRef < Catalog >", field: "root", source: Shared { source: FromPrimitive { typ: "Option < MaybeRef < NameDictionary > >", field: "names", source: Shared { source: FromPrimitive { typ: "Option < NameTree < Primitive > >", field: "javascript", source: Other { msg: "Neither Kids nor Names present in NameTree node." } } } } } } }', src/main.rs:58:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

As a user of the library, I'm not really sure what this error means, but I just downloaded this paper, and tools like pdfinfo and exiftool work fine with it.

MWE:

use std::path::PathBuf;

use pdf::file::File;

fn main() {
    let path = PathBuf::from("../paper.pdf");
    let file = File::<Vec<u8>>::open(&path).unwrap();
    println!("Num pages: {}", file.num_pages());
}

P.S., unrelated to the present issue, but the examples do not work as 0.8.1 has not been released yet. When will this be released?

s3bk commented

Let me see. that should be an easy fix.
I guess I should create a named commit for the crates.io version. I will release a new version after this is fixed.

s3bk commented

Should be fixed and 0.8.1 is published

s3bk commented

I have treated this as an empty node.