LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-16-2022, 06:41 PM   #1
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Rep: Reputation: 73
pdfplumber im.show doesn't work but im.save() works fine


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.
 
Old 12-17-2022, 04:47 PM   #2
Pedroski
Senior Member
 
Registered: Jan 2002
Location: Nanjing, China
Distribution: Ubuntu 20.04
Posts: 2,116

Original Poster
Rep: Reputation: 73
Later, I remembered, I had a similar problem before.

After installing a module, I noticed that im.show() would not work.

I ran the programme in a VENV, then it worked!

So solved!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Jabra UC Voice worked fine in Gnome but doesn't show up in XFCE Cr0wb4r Linux - Software 0 03-12-2014 07:45 PM
Internet works on windows fine, but doesn't work in linux for some websites TimmyTurner Linux - Networking 10 02-27-2011 10:45 AM
Wireless network connects and works fine, but doesnt show up on the network manager newbie236 Linux - Newbie 1 07-07-2010 12:47 AM
[SOLVED] wine 0.9.46 works fine with Doom 3 but 0.9.47 doesn't lord_didger Linux - Software 4 10-22-2007 01:00 PM
Echo /devPrinting doesn't work, echo /usb/lp0 works, Testpage works, Printing doesn't Hegemon Linux - General 3 08-15-2002 01:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration