Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Unified Diff: printing/printing_context.cc

Issue 294923005: Add media size capability to PDF printer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Retrieve PDF printer capabilites via the same API as for any other local printer. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: printing/printing_context.cc
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
index 817d59c93b283cc974b581b78e03cd364356ef01..20ee8cd1785acd92878c450d86dfdd1075a81013 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) {
@@ -85,7 +103,8 @@ PrintingContext::Result PrintingContext::UpdatePrintSettings(
if (media_size->GetInteger(kSettingMediaSizeWidthMicrons,
&width_microns) &&
media_size->GetInteger(kSettingMediaSizeHeightMicrons,
- &height_microns)) {
+ &height_microns) &&
+ settings_.device_units_per_inch() > 0) {
Vitaly Buka (NO REVIEWS) 2014/05/22 01:11:21 ?
Aleksey Shlyapnikov 2014/05/22 03:51:18 Done.
float deviceMicronsPerDeviceUnit =
(kHundrethsMMPerInch * 10.0f) / settings_.device_units_per_inch();
paper_size = gfx::Size(width_microns / deviceMicronsPerDeviceUnit,
« components/cloud_devices/common/printer_description.cc ('K') | « printing/printing_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698