jrmuizel / pdf-extract

A rust library for extracting content from pdfs
396 stars 78 forks source link

Error in compiling the example #13

Open hasanAjsf opened 5 years ago

hasanAjsf commented 5 years ago

While compiling the example I got the below errors and warnings:

   Compiling rust v0.1.0 (/Users/hasan/PycharmProjects/rust)
warning: trait objects without an explicit `dyn` are deprecated
  --> src/main.rs:26:25
   |
26 |     let mut output: Box<OutputDev> = match output_kind.as_ref() {
   |                         ^^^^^^^^^ help: use `dyn`: `dyn OutputDev`
   |
   = note: `#[warn(bare_trait_objects)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
  --> src/main.rs:27:74
   |
27 |         "txt" => Box::new(PlainTextOutput::new(&mut output_file as (&mut std::io::Write))),
   |                                                                          ^^^^^^^^^^^^^^ help: use `dyn`: `dyn std::io::Write`

error[E0308]: mismatched types
  --> src/main.rs:24:20
   |
24 |     print_metadata(&doc);
   |                    ^^^^ expected struct `lopdf::document::Document`, found a different struct `lopdf::document::Document`
   |
   = note: expected type `&lopdf::document::Document` (struct `lopdf::document::Document`)
              found type `&lopdf::document::Document` (struct `lopdf::document::Document`)
note: Perhaps two different versions of crate `lopdf` are being used?
  --> src/main.rs:24:20
   |
24 |     print_metadata(&doc);
   |                    ^^^^

error[E0308]: mismatched types
  --> src/main.rs:33:16
   |
33 |     output_doc(&doc, output.as_mut());
   |                ^^^^ expected struct `lopdf::document::Document`, found a different struct `lopdf::document::Document`
   |
   = note: expected type `&lopdf::document::Document` (struct `lopdf::document::Document`)
              found type `&lopdf::document::Document` (struct `lopdf::document::Document`)
note: Perhaps two different versions of crate `lopdf` are being used?
  --> src/main.rs:33:16
   |
33 |     output_doc(&doc, output.as_mut());
   |                ^^^^

error: aborting due to 2 previous errors
mainrs commented 4 years ago

The output says it all. You probably use a newer version of lopdf compared to this crate.

ghost commented 4 years ago

18 should resolve this :smile:

ngirard commented 2 years ago

@hasanAjsf, can we consider this issue as solved ?