It very much depends on what kind of pdfs you are trying to read, I use something like this to scrape pdf bank statements:
{pdf_as_text,_} = System.cmd("pdftotext", ~w[-raw bank_statement.pdf -], cd: "/Users/myuser/hello_phoenix/pdfs/")
pdf_as_text
|> String.split("\n")
|> Stream.map(fn line ->
regexline = Regex.run(~r/(^\d{1,2}\.\d{1,2}\.\d{4})\s(.+?(?=\s\d{1,2}\.\d{1,2}))\s(\d{1,2}\.\d{1,2})\s(.+?(?=\s))\s(.*)/, line)
case regexline do
[_,full_date, text, date, amount, total] ->
{full_date, text, date, amount, total}
_ ->
nil
end
end) |> Enum.reject( fn(x) -> x == nil end) |> Enum.to_list |> IO.inspect
basically gets raw text from pdf and then runs a regex on each line, also explore the -layout option for pdftotext, depending on your use case..


















