def pdf_show(self, pg_nr): # get Pixmap of a page p = self.doc[pg_nr - 1] pix = p.getPixmap(alpha=0) bitmap = bmp_from_buffer(pix.width, pix.height, pix.samples) self.paperform.Label = "Format: " + FindFit(pix.w, pix.h) return bitmap
def pdf_show(self, pg_nr): # get Pixmap of a page p = self.doc.loadPage(pg_nr - 1) pix = p.getPixmap() a = pix.samplesRGB() bitmap = bmp_from_buffer(pix.width, pix.height, a) self.paperform.Label = "Format: " + FindFit(pix.w, pix.h) return bitmap
def pdf_show(self, pg_nr): page = self.doc.loadPage(int(pg_nr) - 1) # load the page & get Pixmap pix = page.getPixmap(matrix=self.matrix) bmp = bmp_buffer(pix.w, pix.h, pix.samples) paper = FindFit(page.bound().x1, page.bound().y1) self.paperform.Label = "Page format: " + paper if self.links.Value: self.current_lnks = page.getLinks() self.pg_ir = page.bound().round() page = None pix = None return bmp
def pdf_show(self, pno): page = self.doc[getint(pno) - 1] # load page & get Pixmap pix = page.getPixmap(matrix=self.zoom, alpha=False) bmp = wx.Bitmap.FromBuffer(pix.w, pix.h, pix.samples) paper = FindFit(page.rect.width, page.rect.height) self.paperform.Label = "Page format: " + paper self.page_links = page.getLinks() self.update_links = True if len(self.page_links) > 0: if self.page_links[0]["xref"] < 1: self.update_links = False self.page_height = page.rect.height self.text_blocks = page.getTextBlocks() return bmp
def pdf_show(self, pg_nr): pno = int(pg_nr) - 1 if self.dl_array[pno] == 0: self.dl_array[pno] = self.doc[pno].getDisplayList() dl = self.dl_array[pno] pix = dl.getPixmap(matrix = self.matrix, alpha = False) bmp = bmp_buffer(pix.w, pix.h, pix.samples) r = dl.rect paper = FindFit(r.x1, r.y1) self.paperform.Label = "Page format: " + paper if self.links.Value: self.current_lnks = self.doc[pno].getLinks() self.pg_ir = dl.rect.irect pix = None return bmp
def pdf_show(self, pg_nr): page = self.doc.loadPage(int(pg_nr) - 1) # load the page & get Pixmap pix = page.getPixmap(matrix = self.matrix) bmp = wx.BitmapFromBuffer(pix.w, pix.h, pix.samplesRGB()) if do_paper: paper = FindFit(page.bound().x1, page.bound().y1) else: paper = "not implemented" self.paperform.Label = "Page format: " + paper if self.links.Value: self.current_lnks = page.getLinks() self.pg_ir = page.bound().round() page = None pix = None return bmp
def pdf_show(self, pno): page = self.doc[getint(pno) - 1] # load page & get Pixmap width = page.rect.width height = page.rect.height if width / height < MAX_WIDTH / MAX_HEIGHT: zoom = MAX_HEIGHT / height else: zoom = MAX_WIDTH / width self.zoom = fitz.Matrix(zoom, zoom) self.shrink = ~self.zoom pix = page.getPixmap(matrix=self.zoom, alpha=False) bmp = wx.Bitmap.FromBuffer(pix.w, pix.h, pix.samples) paper = FindFit(page.rect.width, page.rect.height) self.paperform.Label = "Page format: " + paper self.page_images = get_images(page) self.page_height = page.rect.height return bmp
def pdf_show(self, pno): page = self.doc.loadPage(getint(pno) - 1) # load page & get Pixmap pix = page.getPixmap(matrix=self.zoom) bmp = bmp_buffer(pix.w, pix.h, pix.samples) paper = FindFit(page.bound().x1, page.bound().y1) self.paperform.Label = "Page format: " + paper self.page_links = page.getLinks() if len(self.page_links) > 0: l = self.page_links[0] if l["xref"] > 0: self.update_links = True else: self.update_links = False else: self.update_links = True self.page_height = page.rect.height page = None pix = None return bmp