You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn check_file(file_path: &str) {
let Ok(content) = fs::read(file_path) else {
return;
};
let cursor = Cursor::new(content);
match Document::load_from(cursor) {
Ok(mut document) => {
let pages = document.get_pages();
let mut doc_clone = document.clone();
doc_clone.decompress();
for (i, _) in pages.iter().enumerate() {
let page_number = (i + 1) as u32;
let _text = document.extract_text(&[page_number]);
}
let _ = document.save_to(&mut Cursor::new(Vec::new()));
}
Err(err) => {
eprintln!("Error reading PDF contents: {}", err)
}
}
}
cause this
thread 'main' panicked at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/7f24a1c/src/object.rs:360:9:
Encoding should be only retrieved from Font type dictionaries!
stack backtrace:
0: rust_begin_unwind
at /rustc/e92993dbb43f0a5d17fe56e2d82f90435d6521c8/library/std/src/panicking.rs:665:5
1: core::panicking::panic_fmt
at /rustc/e92993dbb43f0a5d17fe56e2d82f90435d6521c8/library/core/src/panicking.rs:74:14
2: lopdf::object::Dictionary::get_font_encoding
at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/7f24a1c/src/object.rs:360:9
3: lopdf::parser_aux::<impl lopdf::document::Document>::extract_text::{{closure}}
at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/7f24a1c/src/parser_aux.rs:77:37
4: core::iter::adapters::map::map_try_fold::{{closure}}
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:95:28
5: core::iter::traits::iterator::Iterator::try_fold
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2406:21
6: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:121:9
7: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::try_fold
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/mod.rs:191:9
8: core::iter::traits::iterator::Iterator::try_for_each
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2468:9
9: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/mod.rs:174:14
10: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter_nested.rs:25:32
11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/spec_from_iter.rs:34:9
12: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3410:9
13: core::iter::traits::iterator::Iterator::collect
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2001:9
14: <alloc::collections::btree::map::BTreeMap<K,V> as core::iter::traits::collect::FromIterator<(K,V)>>::from_iter
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/collections/btree/map.rs:2256:34
15: core::iter::traits::iterator::Iterator::collect
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2001:9
16: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1979:51
17: core::iter::adapters::try_process
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/mod.rs:160:17
18: <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1979:9
19: core::iter::traits::iterator::Iterator::collect
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2001:9
20: lopdf::parser_aux::<impl lopdf::document::Document>::extract_text
at /home/runner/.cargo/git/checkouts/lopdf-0013854ec52a6141/7f24a1c/src/parser_aux.rs:78:18
21: lopdf::check_file
at ./src/crates/lopdf/src/main.rs:41:29
22: lopdf::main
at ./src/crates/lopdf/src/main.rs:23:9
23: core::ops::function::FnOnce::call_once
at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
##### Automatic Fuzzer note, output status "None", output signal "Some(6)"
code
cause this
compressed.zip
The text was updated successfully, but these errors were encountered: