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 --- fpdfsdk/fpdf_view.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index 60be46b977..28e42a8e81 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -59,6 +59,12 @@ static_assert(WindowsPrintMode::kModePostScript2 == FPDF_PRINTMODE_POSTSCRIPT2, "WindowsPrintMode::kModePostScript2 value mismatch"); static_assert(WindowsPrintMode::kModePostScript3 == FPDF_PRINTMODE_POSTSCRIPT3, "WindowsPrintMode::kModePostScript3 value mismatch"); +static_assert(WindowsPrintMode::kModePostScript2PassThrough == + FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH, + "WindowsPrintMode::kModePostScript2PassThrough value mismatch"); +static_assert(WindowsPrintMode::kModePostScript3PassThrough == + FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH, + "WindowsPrintMode::kModePostScript3PassThrough value mismatch"); #endif namespace { @@ -210,8 +216,10 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi) { #endif // PDFIUM_PRINT_TEXT_WITH_GDI FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SetPrintMode(int mode) { - if (mode < FPDF_PRINTMODE_EMF || mode > FPDF_PRINTMODE_POSTSCRIPT3) + if (mode < FPDF_PRINTMODE_EMF || + mode > FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH) { return FALSE; + } g_pdfium_print_mode = static_cast(mode); return TRUE; } -- cgit v1.2.3