From 15cf137793a4d90f8a5eefd2b7f3044b90574d19 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 10 Aug 2016 13:07:02 +0530 Subject: [PATCH] PDF Output: Fix a regression that caused the last page of a chapter to sometimes be dropped from the output --- src/calibre/ebooks/pdf/render/engine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/pdf/render/engine.py b/src/calibre/ebooks/pdf/render/engine.py index c0700cbcfc..6608f2b7d5 100644 --- a/src/calibre/ebooks/pdf/render/engine.py +++ b/src/calibre/ebooks/pdf/render/engine.py @@ -285,7 +285,8 @@ class PdfEngine(QPaintEngine): last_x, last_y = x, y if not self.content_written_to_current_page: - ypositions = [y for x, y in gi.positions] + painter_top = self.painter().clipPath().boundingRect().y() + ypositions = [y - painter_top for x, y in gi.positions] miny = min(ypositions or (0,)) maxy = max(ypositions or (self.pixel_height,)) page_top = self.header_height if self.has_headers else 0