pdfquery example from documentation

By Vipin

i was working on the pdf query example from the documentation on pdf IRS_1040A.pdf
but it is showing error:-

C:Python27python.exe I:/Pycharmprojects/hello.py

Traceback (most recent call last):

File “I:/Pycharmprojects/hello.py”, line 1, in

import pdfquery

File “C:Python27libsite-packagespdfquery__init__.py”, line 1, in

from .pdfquery import PDFQuery

File “C:Python27libsite-packagespdfquerypdfquery.py”, line 16, in

from pdfminer.psparser import PSLiteral

ImportError: No module named psparser

Process finished with exit code 1

the code i used

import pdfquery
pdf = pdfquery.PDFQuery("I:PycharmprojectsIRS_1040A.pdf")
label = pdf.pq('LTTextLineHorizontal:contains("Your first name and initial")')
left_corner = float(label.attr('x0'))
bottom_corner = float(label.attr('y0'))
name = pdf.pq('LTTextLineHorizontal:in_bbox("%s, %s, %s, %s")' % (left_corner, bottom_corner-30, left_corner+150, bottom_corner)).text()
print name

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273