Skip to content

Commit

Permalink
print all pages
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jul 27, 2024
1 parent 6dff61f commit f3c0e92
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xpra/platform/win32/pdfium.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f3c0e92

Please sign in to comment.