Python Forum
How to display a pdf file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to display a pdf file (/thread-25595.html)



How to display a pdf file - arbiel - Apr-04-2020

Hi

I'm migrating a bash script I coded, which reads pdf files (pages of a ancient greek to french dictionnary) and displays them to the user. I tried the pipes methods, without success as the pdf viewer does not seem able to display what it get on /dev/stdin.

Has anybody an idea on how I can achieve this goal ?

Arbiel


RE: Displaying a pdf file - jefsummers - Apr-04-2020

Depends a bit on which graphics package you are using.
If Tkinter, try https://www.codespeedy.com/how-to-create-a-pdf-viewer-using-python/


RE: How to display a pdf file - steve_shambles - Apr-05-2020

This works for me:
>>>import webbrowser as wb
>>> wb.open('test.pdf')


RE: How to display a pdf file - arbiel - Apr-05-2020

Thank at both of you

I've tried steve_shambles's solution and I'm quite happy with it.

Arbiel