Actually, I'm trying to get table data from a pdf, but the table has not borders. Turns out, it is quite tricky to pick up the empty cells as well! But that's not relevant here!
The
documentation for pdfplumber at PyPi clearly states that im.show() should work.
Code:
pdf1 = pdfplumber.open(path2pdf + my_pdf)
page = pdf1.pages[0]
cropped_page = page.crop(bounding_box)
im = cropped_page.to_image(resolution=150)
im.save(path2pdf + "test1.png", format="PNG")
The documentation also says change /etc/ImageMagick-6/policy.xml from
Quote:
<policy domain="coder" rights="none" pattern="PDF" />
|
to
Quote:
<policy domain="coder" rights="read|write" pattern="PDF" />
|
I did that, rebooted to be sure the new policy was loaded.
But still im.show() won't work. This in the Idle shell:
Quote:
>>> im.show()
Traceback (most recent call last):
File "/usr/lib/python3.8/idlelib/run.py", line 559, in runcode
exec(code, self.locals)
File "<pyshell#19>", line 1, in <module>
AttributeError: 'PageImage' object has no attribute 'show'
>>>
|
Like I said, I can save the cropped page image.
Any ideas why im.show() won't work?
I do a similar thing for my little multi-choice answer form programme and there im.show() works.