From f3c0e92d3b5b85b7c05d898ad51ed7d24af6ece3 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sat, 27 Jul 2024 10:18:37 +0700 Subject: [PATCH] print all pages --- xpra/platform/win32/pdfium.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xpra/platform/win32/pdfium.py b/xpra/platform/win32/pdfium.py index 18bf13584c..c9cca9c05c 100755 --- a/xpra/platform/win32/pdfium.py +++ b/xpra/platform/win32/pdfium.py @@ -17,7 +17,7 @@ from xpra.os_util import strtobytes from xpra.platform.win32.common import GetDeviceCaps from xpra.platform.win32 import win32con -from xpra.platform.win32.win32_printing import GDIPrinterContext, DOCINFO, StartDocA, EndDoc, LPCSTR +from xpra.platform.win32.win32_printing import GDIPrinterContext, DOCINFO, StartDocA, EndDoc, StartPage, EndPage, LPCSTR LIBPDFIUMDLL = os.environ.get("XPRA_LIBPDFIUMDLL", "pdfium.dll") try: @@ -54,6 +54,8 @@ class FPDF_LIBRARY_CONFIG(Structure): FPDF_LoadMemDocument.argtypes = [c_void_p, c_int, c_void_p] FPDF_CloseDocument = pdfium.FPDF_CloseDocument FPDF_CloseDocument.argtypes = [FPDF_DOCUMENT] +FPDF_ClosePage = pdfium.FPDF_ClosePage +FPDF_ClosePage.argtypes = [FPDF_PAGE] FPDF_ERR_SUCCESS = 0 # No error. FPDF_ERR_UNKNOWN = 1 # Unknown error. @@ -138,7 +140,10 @@ def do_print_pdf(hdc, title=b"PDF Print Test", pdf_data=None): log.error("Error: FPDF_LoadPage failed for page %i, error: %s", i, get_error()) return -2 log("FPDF_LoadPage()=%s page %i loaded", page, i) + StartPage(hdc) FPDF_RenderPage(hdc, page, x, y, w, h, rotate, flags) + FPDF_ClosePage(hdc) + EndPage(hdc) log("FPDF_RenderPage page %i rendered", i) finally: EndDoc(hdc)