Rendering PDF in PyQT5

Wilbert Berendsen wb at xs4all.nl
Tue Jul 7 06:33:14 BST 2020


Op Tue, 30 Jun 2020 14:28:12 +0200
Justin Giffard <jusgif at gmail.com> schreef:

> Hi there
> 
> Asked recently about a print preview in PyQT5 and Paolo attempted to
> help me but we came to the conclusion that there's no real way to do
> this out of the box. I then started investigating making my own print
> preview screen but we can't really find a decent way to do it display
> the PDF. I have tried a webview in the past which seemed to work okay
> but Paolo came across a C++ QT5 example that made use of a
> QPdfDocument which I later found was held by the QPdfView. This had
> me excited until I found that it would seem that this is not
> implemented in PyQT5. Damn another brick wall.
> 
> Can anyone make any suggestions on this?

You could use QPageView: https://qpageview.org/

It uses the python binding of Poppler-Qt5 for rendering
https://pypi.org/project/python-poppler-qt5/

Good luck!

-- 
Wilbert Berendsen (www.wilbertberendsen.nl)


More information about the PyQt mailing list