summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authoralekseys@chromium.org <alekseys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-29 16:32:48 +0000
committeralekseys@chromium.org <alekseys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-29 16:32:48 +0000
commit2dafb8b1a11efdbd65c6df2ca5f670980df783e8 (patch)
tree111d8c15e336902d88811dd50c0f19a3c59bacfc /printing
parent57f12776e5aa51ab0b60cd31b12f0acbe3d97207 (diff)
downloadchromium_src-2dafb8b1a11efdbd65c6df2ca5f670980df783e8.zip
chromium_src-2dafb8b1a11efdbd65c6df2ca5f670980df783e8.tar.gz
chromium_src-2dafb8b1a11efdbd65c6df2ca5f670980df783e8.tar.bz2
Add media size capability to PDF printer.
BUG=239879 Review URL: https://codereview.chromium.org/294923005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/printing_context.cc18
-rw-r--r--printing/printing_context.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
index 817d59c..8d438d0 100644
--- a/printing/printing_context.cc
+++ b/printing/printing_context.cc
@@ -48,6 +48,24 @@ PrintingContext::Result PrintingContext::OnError() {
return abort_printing_ ? CANCEL : FAILED;
}
+PrintingContext::Result PrintingContext::UsePdfSettings() {
+ scoped_ptr<base::DictionaryValue> pdf_settings(new base::DictionaryValue);
+ pdf_settings->SetBoolean(kSettingHeaderFooterEnabled, false);
+ pdf_settings->SetBoolean(kSettingShouldPrintBackgrounds, false);
+ pdf_settings->SetBoolean(kSettingShouldPrintSelectionOnly, false);
+ pdf_settings->SetInteger(kSettingMarginsType, printing::NO_MARGINS);
+ pdf_settings->SetBoolean(kSettingCollate, true);
+ pdf_settings->SetInteger(kSettingCopies, 1);
+ pdf_settings->SetInteger(kSettingColor, printing::COLOR);
+ pdf_settings->SetInteger(kSettingDuplexMode, printing::SIMPLEX);
+ pdf_settings->SetBoolean(kSettingLandscape, false);
+ pdf_settings->SetString(kSettingDeviceName, "");
+ pdf_settings->SetBoolean(kSettingPrintToPDF, true);
+ pdf_settings->SetBoolean(kSettingCloudPrintDialog, false);
+ pdf_settings->SetBoolean(kSettingPrintWithPrivet, false);
+ return UpdatePrintSettings(*pdf_settings, PageRanges());
+}
+
PrintingContext::Result PrintingContext::UpdatePrintSettings(
const base::DictionaryValue& job_settings,
const PageRanges& ranges) {
diff --git a/printing/printing_context.h b/printing/printing_context.h
index 7a0a8c8..fedf696 100644
--- a/printing/printing_context.h
+++ b/printing/printing_context.h
@@ -51,6 +51,9 @@ class PRINTING_EXPORT PrintingContext {
// default device settings.
virtual Result UseDefaultSettings() = 0;
+ // Updates the context with PDF printer settings.
+ Result UsePdfSettings();
+
// Returns paper size to be used for PDF or Cloud Print in device units.
virtual gfx::Size GetPdfPaperSizeDeviceUnits() = 0;