Skip to content

Display PDF Page in PyQT5 #1046

Discussion options

You must be logged in to vote

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 page.get_text("dict"). You will get all text pieces including color, font, orientation, position and similarly images, so you can compose some…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@dmytro-balabukh
Comment options

@JorjMcKie
Comment options

@dmytro-balabukh
Comment options

@JorjMcKie
Comment options

Answer selected by dmytro-balabukh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants