jrmuizel / pdf-extract

A rust library for extracting content from pdfs
364 stars 73 forks source link

extract_text_from_mem not found in `pdf_extract` #55

Closed felixbecker closed 1 year ago

felixbecker commented 1 year ago

I am trying to get the example lines from the readme work but without success.

This is my main.rs

extern crate pdf_extract;

use pdf_extract::*;

fn main() {
    println!("Hello, world!");

    let bytes = std::fs::read("tests/docs/simple.pdf").unwrap();
    let out = pdf_extract::extract_text_from_mem(&bytes).unwrap();
    assert!(out.contains("This is a small demonstration"));
}

This is my cargo.toml

[package]
name = "pdfreader"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
pdf-extract = "0.6.4"

This is the error I get:

error[E0425]: cannot find function `extract_text_from_mem` in crate `pdf_extract`
 --> src/main.rs:9:28
  |
9 |     let out = pdf_extract::extract_text_from_mem(&bytes).unwrap();
  |                            ^^^^^^^^^^^^^^^^^^^^^ not found in `pdf_extract`

Can anyone help me what I am missing here?

JulianWgs commented 1 year ago

You are getting this error, because the function hasn't been released to crates.io, yet. Here is the diff from the current master to the last release: https://github.com/jrmuizel/pdf-extract/compare/v0.6.4...master

It would be nice if the author could make a release of the current master branch :)

felixbecker commented 1 year ago

Referencing the git repo in my toml worked. @jrmuizel would be great if you could find the time to update the crate at cargo.

jrmuizel commented 1 year ago

Done