From 2526c818fc336d5bc2ea4ee77dfd40f6fde4ad84 Mon Sep 17 00:00:00 2001 From: GrabzIt Date: Sat, 8 Apr 2017 10:48:43 +0100 Subject: [PATCH] Added support for PDF scaling --- CefSharp.Core/Internals/CefBrowserHostWrapper.cpp | 1 + CefSharp/PdfPrintSettings.cs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp b/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp index 0372eb7b2..81c0fa4f2 100644 --- a/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp +++ b/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp @@ -89,6 +89,7 @@ void CefBrowserHostWrapper::PrintToPdf(String^ path, PdfPrintSettings^ settings, nativeSettings.margin_top = settings->MarginTop; nativeSettings.margin_left = settings->MarginLeft; nativeSettings.margin_right = settings->MarginRight; + nativeSettings.scale_factor = settings->ScaleFactor; nativeSettings.page_height = settings->PageHeight; nativeSettings.page_width = settings->PageWidth; nativeSettings.margin_type = static_cast(settings->MarginType); diff --git a/CefSharp/PdfPrintSettings.cs b/CefSharp/PdfPrintSettings.cs index 92c0127f6..6df84fae1 100644 --- a/CefSharp/PdfPrintSettings.cs +++ b/CefSharp/PdfPrintSettings.cs @@ -58,6 +58,11 @@ namespace CefSharp /// public CefPdfPrintMarginType MarginType { get; set; } + /// + /// Scale the PDF by the specified amount, defaults to 100%. + /// + public int ScaleFactor { get; set; } + /// /// Set to true to print headers and footers or false to not print /// headers and footers.