I am extracting a pdf into images / swf and text with the help of SWFTools and XPDF.. I am running these in a PDF script.
But now I am trying to go one step further and try to get the TOC from the PDF is it possible to extract this information?
Docparser is a PDF scraper software that allows you to automatically pull data from recurring PDF documents on scale. Like web-scraping (collecting data by crawling the internet), scraping PDF documents is a powerful method to automatically convert semi-structured text documents into structured data.
I found this with a little bit of searching. It looks rather promising.
PDFMiner: http://www.unixuser.org/~euske/python/pdfminer/index.html
Note: The tool is Python based, but you should be able to use the tool via shell access. Alternatively, you may be able to glean some useful info from the source code itself, as the project is open source.
From the Site:
dumppdf.py
dumppdf.py dumps the internal contents of a PDF file in pseudo-XML format. This program is primarily for debugging purposes, but it's also possible to extract some meaningful contents (such as images).
Examples:
$ dumppdf.py -a foo.pdf (dump all the headers and contents, except stream objects) $ dumppdf.py -T foo.pdf (dump the table of contents) $ dumppdf.py -r -i6 foo.pdf > pic.jpeg (extract a JPEG image)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With