Ask HN: Recommendations for PDF text extraction
We need to be able to get at text that is contained in pre-known regions of the document, so the API will need to give us positional information of each element on the page.
Thanks for any suggestions.
We need to be able to get at text that is contained in pre-known regions of the document, so the API will need to give us positional information of each element on the page.
Thanks for any suggestions.
We observed that the text in our pdf had a structure to it. So instead we simply dumped the text from pdf using pdftotext and wrote an ANTLR grammar for the structure we saw. This enabled us to parse relevant information from the text dump.
This was a system used in production but had several checks and fallback mechanisms because the process was unreliable.
TET provides precise metrics for the text, such as the position on the page, glyph widths, and text direction. Specific areas on the page can be excluded or included in the text extraction, e.g. to ignore headers and footers or margins.
If anyone has any questions, feel free to ping me.
Poppler is the library that pdftohtml uses for this.