Re: Extracting tabular text from a pdf
On Wednesday, November 27, 2019 12:07:16 PM Richard Owlett wrote:
> I'm trying to create some spreadsheets containing nutritional data.
>
> Sample documents I'm using for input include:
> > https://choosemyplate-prod.azureedge.net/sites/default/files/2WeekMenusGr
> > oceryList.pdf
> >
> > https://choosemyplate-prod.azureedge.net/sites/default/files/2WeekMenusAn
> > dFoodGroupContent.pdf
> >
> > http://www.nhlbi.nih.gov/files/docs/public/heart/new_dash.pdf
>
> Using "pdftotext -layout input.pdf output.txt" is tantalizingly close
> to what I want.
>
> When PRINTED that visually preserves relationships.
> I wish to copy a column of data to a spreadsheet, but can only select
> horizontally, NOT vertically.
I didn't try your pdftotext command, so I don't know how tantalizingly close
that got you.
I opened one of the .pdfs in Okular, then switched to selection mode and
selected a column of data using the mouse. I then copied it to a text editor.
It looks very columnar to me, with the only (minor) problems being an extra
line containing some unprintable characters (□ -- copied and pasted here, but
they show up differently in nedit) (and a line end character).
I'm sure that could easily be imported into a spreadsheet just specifying
those unprintable characters as the record separator (using that text file).
(I used Okular 0.14.3 as distributed in Wheezy.)
>
> I suspect it may not be practical in the general case.
> Are there any examples that might come close?
Reply to: