Display PDF Page in PyQT5 #1046
-
Im doing some work on my bookReaderProject. As I have mentioned in an article, I do it using PyQT5. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
And why don't you use raster image output? I.e. use a pixmap and make a Qt image from it like so from PyQt<x>.QtGui import QImage
# ...
pix = page.get_pixmap(...) # choose appropriate arguments,
# to control zooming and the right sub-rectangle part of the
# page
# set the correct QImage format depending on alpha
# ... presumably you want alpha=False
fmt = QImage.Format_RGBA8888 if pix.alpha else QImage.Format_RGB888
qtimg = QImage(pix.samples, pix.width, pix.height, pix.stride, fmt)
# use qtimg as a QImage Of course nothing prevents you from using |
Beta Was this translation helpful? Give feedback.
And why don't you use raster image output? I.e. use a pixmap and make a Qt image from it like so
Of course nothing prevents you from using
page.get_text("dict")
. You will get all text pieces including color, font, orientation, position and similarly images, so you can compose some…