diff options
author | rbpotter <rbpotter@chromium.org> | 2017-01-12 10:31:43 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-12 10:31:43 -0800 |
commit | db7647083d0a5cd2221b94faa15c149214d21725 (patch) | |
tree | 427c0beeb82796e8e550e672195061186d7db076 /fpdfsdk/fpdfview.cpp | |
parent | e7fb8eb3e9f220a5f0c852f0238ab8d536a8bc9d (diff) | |
download | pdfium-db7647083d0a5cd2221b94faa15c149214d21725.tar.xz |
Add postscript path
This patch adds the additional functions required to make postscript
printing functional. The most significant additions are are two added
compression functions and a new API for setting the postscript level.
Not currently called from Chromium, Chromium patch to come.
BUG=
Review-Url: https://codereview.chromium.org/2612243005
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index c292384e88..ff4d46e357 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -429,7 +429,8 @@ DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, return FSDK_SetSandBoxPolicy(policy, enable); } -#if defined(_WIN32) && defined(PDFIUM_PRINT_TEXT_WITH_GDI) +#if defined(_WIN32) +#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) DLLEXPORT void STDCALL FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func) { g_pdfium_typeface_accessible_func = func; @@ -438,7 +439,15 @@ FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func) { DLLEXPORT void STDCALL FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi) { g_pdfium_print_text_with_gdi = !!use_gdi; } -#endif +#endif // PDFIUM_PRINT_TEXT_WITH_GDI + +DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(int postscript_level) { + if (postscript_level != 0 && postscript_level != 2 && postscript_level != 3) + return FALSE; + g_pdfium_print_postscript_level = postscript_level; + return TRUE; +} +#endif // defined(_WIN32) DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password) { @@ -656,6 +665,9 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, pPage->SetRenderContext(pdfium::WrapUnique(pContext)); std::unique_ptr<CFX_DIBitmap> pBitmap; + // TODO: This results in unnecessary rasterization of some PDFs due to + // HasImageMask() returning true. If any image on the page is a mask, the + // entire page gets rasterized and the spool size gets huge. const bool bNewBitmap = pPage->BackgroundAlphaNeeded() || pPage->HasImageMask(); if (bNewBitmap) { |