开发者

Scraping data from PDF to CSV? Python vs PHP?

I have a bunch of reports that I'm hand-compiling every day and it's taking forever, so I was thinking of automating the whole process. I will be scraping data from: (1) HTML, (2) CSV/XLS, (3) PDF. I have mainly only scraped data from CSV/HTML with PHP and was wondering if there are any dependable libraries or ways of grabbing table data from a PDF in PHP?

I have al开发者_运维技巧so just started learning Python and see that it might be a good idea to try doing this with PDFMiner in conjunction with Scrapy. Would this be better? Or are there other options?

Please let me know. Thanks!


Beautiful Soup is another good alternative for scraping and PDFminer has been the best PDF parser for Python I have found. I use pdf2txt.py mostly and then re-format from there if needed.


If you have command line access to a linux server try the pdftotext command

$ pdftotext file.pdf

If you're lucky you'll get something that you can work with. Depending on the PDF the text may come out weird from the way the tables were originally formatted, in my experience anyway. Good Luck.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜