From 9ed6bd7150a9333cb28d149c98e3d316c3ededdf Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 25 Apr 2018 21:10:05 +0000 Subject: Add PostScript PASSTHROUGH options to FPDF_SetPrintMode(). The existing PostScript modes write data into EMF comments. This satisfies Chromium's use case, but other embedders want to write data out via ExtEscape() in PASSTHROUGH mode. BUG=pdfium:1068 Change-Id: I998035e99fbb84b16dcd244b750b476cecc3bd22 Reviewed-on: https://pdfium-review.googlesource.com/31299 Commit-Queue: Lei Zhang Reviewed-by: dsinclair Reviewed-by: Rebekah Potter --- core/fxge/win32/fx_win32_print.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'core/fxge/win32/fx_win32_print.cpp') diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index da40b8a762..f36fa84364 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -334,8 +334,18 @@ CPSPrinterDriver::CPSPrinterDriver(HDC hDC, : m_hDC(hDC), m_bCmykOutput(bCmykOutput) { // |mode| should be PostScript. ASSERT(mode == WindowsPrintMode::kModePostScript2 || - mode == WindowsPrintMode::kModePostScript3); - int pslevel = mode == WindowsPrintMode::kModePostScript2 ? 2 : 3; + mode == WindowsPrintMode::kModePostScript3 || + mode == WindowsPrintMode::kModePostScript2PassThrough || + mode == WindowsPrintMode::kModePostScript3PassThrough); + int pslevel = (mode == WindowsPrintMode::kModePostScript2 || + mode == WindowsPrintMode::kModePostScript2PassThrough) + ? 2 + : 3; + CPSOutput::OutputMode output_mode = + (mode == WindowsPrintMode::kModePostScript2 || + mode == WindowsPrintMode::kModePostScript3) + ? CPSOutput::OutputMode::kGdiComment + : CPSOutput::OutputMode::kExtEscape; m_HorzSize = ::GetDeviceCaps(m_hDC, HORZSIZE); m_VertSize = ::GetDeviceCaps(m_hDC, VERTSIZE); @@ -343,8 +353,8 @@ CPSPrinterDriver::CPSPrinterDriver(HDC hDC, m_Height = ::GetDeviceCaps(m_hDC, VERTRES); m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); - m_PSRenderer.Init(pdfium::MakeRetain(m_hDC), pslevel, m_Width, - m_Height, bCmykOutput); + m_PSRenderer.Init(pdfium::MakeRetain(m_hDC, output_mode), pslevel, + m_Width, m_Height, bCmykOutput); HRGN hRgn = ::CreateRectRgn(0, 0, 1, 1); int ret = ::GetClipRgn(hDC, hRgn); if (ret == 1) { -- cgit v1.2.3