From d1f66f551306db8bbb26591c6cef71f444a67fe3 Mon Sep 17 00:00:00 2001 From: Jorge Moraleda Date: Thu, 4 Jun 2020 14:35:41 -0700 Subject: [PATCH] Explicitly indicate that we don't want an alpha channel when rendering pdf pages to account from the fact that the default on this parameter differs between mupdf versions --- wx/lib/pdfviewer/viewer.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/wx/lib/pdfviewer/viewer.py b/wx/lib/pdfviewer/viewer.py index 86ec7e61..2b6ad5a9 100644 --- a/wx/lib/pdfviewer/viewer.py +++ b/wx/lib/pdfviewer/viewer.py @@ -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):