Python Forum
How to display memory PDF in wxpython
Thread Rating:
  • 3 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to display memory PDF in wxpython
#1
To view a pdf file with wx.lib.pdfviewer.viewer.pdfViewer, you use:
   pdfV.viewer.LoadFile(r'a path to a .pdf file')
that works well if the pdf happens to be a file on your computer.
what do you do if the pdf is in memory as the result of a a requests like:
doc = requests.get(url)
if doc.status_code != 404:
   found_pdf = True
If necessary, I'll save it to a temp file, but
I'm hoping there's a method for loading from memory

Does anyone know how this is done?
Reply
#2
since pdfV.viewer.LoadFile() wants a path, the only other ways i can see to do this is hope that pdfV.viewer has another method to load from an open file object (e.g. calls object.read()) or some kind of virtual filesystem implemented in Python.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Display and update the label text which display the serial value jenkins43 5 9,068 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 3,884 Jan-05-2019, 01:48 PM
Last Post: wuf

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020