Merge pull request #1659 from jmoraleda/pdfviewer_alpha_fix

Explicitly indicate that we don't want an alpha channel when rendering pdf image
This commit is contained in:
Robin Dunn
2020-06-16 16:52:37 -07:00
committed by GitHub

View File

@@ -515,11 +515,8 @@ class mupdfProcessor(object):
page = self.pdfdoc.loadPage(pageno)
matrix = fitz.Matrix(scale, scale)
try:
pix = page.getPixmap(matrix=matrix) # MUST be keyword arg(s)
if [int(v) for v in fitz.version[1].split('.')] >= [1,15,0]:
bmp = wx.Bitmap.FromBuffer(pix.width, pix.height, pix.samples)
else:
bmp = wx.Bitmap.FromBufferRGBA(pix.width, pix.height, pix.samples)
pix = page.getPixmap(matrix=matrix, alpha=False) # MUST be keyword arg(s)
bmp = wx.Bitmap.FromBuffer(pix.width, pix.height, pix.samples)
gc.DrawBitmap(bmp, 0, 0, pix.width, pix.height)
self.zoom_error = False
except (RuntimeError, MemoryError):