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

Side by Side Diff: components/printing/renderer/print_web_view_helper.cc

Issue 2524143003: Print Preview: Add option to rasterize PDFs and add JPEG compression. (Closed)
Patch Set: Fix pdfium engine and javascript Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/printing/renderer/print_web_view_helper.h" 5 #include "components/printing/renderer/print_web_view_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 page_params->printable_area.set_size( 278 page_params->printable_area.set_size(
279 gfx::Size(page_params->printable_area.height(), 279 gfx::Size(page_params->printable_area.height(),
280 page_params->printable_area.width())); 280 page_params->printable_area.width()));
281 } 281 }
282 282
283 void ComputeWebKitPrintParamsInDesiredDpi( 283 void ComputeWebKitPrintParamsInDesiredDpi(
284 const PrintMsg_Print_Params& print_params, 284 const PrintMsg_Print_Params& print_params,
285 blink::WebPrintParams* webkit_print_params) { 285 blink::WebPrintParams* webkit_print_params) {
286 int dpi = GetDPI(&print_params); 286 int dpi = GetDPI(&print_params);
287 webkit_print_params->printerDPI = dpi; 287 webkit_print_params->printerDPI = dpi;
288 webkit_print_params->rasterizePDF = print_params.rasterize_pdf;
288 webkit_print_params->printScalingOption = print_params.print_scaling_option; 289 webkit_print_params->printScalingOption = print_params.print_scaling_option;
289 290
290 webkit_print_params->printContentArea.width = ConvertUnit( 291 webkit_print_params->printContentArea.width = ConvertUnit(
291 print_params.content_size.width(), dpi, print_params.desired_dpi); 292 print_params.content_size.width(), dpi, print_params.desired_dpi);
292 webkit_print_params->printContentArea.height = ConvertUnit( 293 webkit_print_params->printContentArea.height = ConvertUnit(
293 print_params.content_size.height(), dpi, print_params.desired_dpi); 294 print_params.content_size.height(), dpi, print_params.desired_dpi);
294 295
295 webkit_print_params->printableArea.x = ConvertUnit( 296 webkit_print_params->printableArea.x = ConvertUnit(
296 print_params.printable_area.x(), dpi, print_params.desired_dpi); 297 print_params.printable_area.x(), dpi, print_params.desired_dpi);
297 webkit_print_params->printableArea.y = ConvertUnit( 298 webkit_print_params->printableArea.y = ConvertUnit(
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 } else { 1718 } else {
1718 source_is_html = !PrintingNodeOrPdfFrame(frame, node); 1719 source_is_html = !PrintingNodeOrPdfFrame(frame, node);
1719 } 1720 }
1720 1721
1721 if (print_for_preview_ || !source_is_html) { 1722 if (print_for_preview_ || !source_is_html) {
1722 modified_job_settings.MergeDictionary(job_settings); 1723 modified_job_settings.MergeDictionary(job_settings);
1723 modified_job_settings.SetBoolean(kSettingHeaderFooterEnabled, false); 1724 modified_job_settings.SetBoolean(kSettingHeaderFooterEnabled, false);
1724 modified_job_settings.SetInteger(kSettingMarginsType, NO_MARGINS); 1725 modified_job_settings.SetInteger(kSettingMarginsType, NO_MARGINS);
1725 job_settings = &modified_job_settings; 1726 job_settings = &modified_job_settings;
1726 } 1727 }
1728 bool raster = false;
1729 job_settings->GetBoolean(kSettingRasterizePdf, &raster);
Vitaly Buka (NO REVIEWS) 2016/12/15 08:27:34 value is not used?
rbpotter 2016/12/16 00:06:31 Done.
1727 1730
1728 // Send the cookie so that UpdatePrintSettings can reuse PrinterQuery when 1731 // Send the cookie so that UpdatePrintSettings can reuse PrinterQuery when
1729 // possible. 1732 // possible.
1730 int cookie = 1733 int cookie =
1731 print_pages_params_ ? print_pages_params_->params.document_cookie : 0; 1734 print_pages_params_ ? print_pages_params_->params.document_cookie : 0;
1732 PrintMsg_PrintPages_Params settings; 1735 PrintMsg_PrintPages_Params settings;
1733 bool canceled = false; 1736 bool canceled = false;
1734 Send(new PrintHostMsg_UpdatePrintSettings(routing_id(), cookie, *job_settings, 1737 Send(new PrintHostMsg_UpdatePrintSettings(routing_id(), cookie, *job_settings,
1735 &settings, &canceled)); 1738 &settings, &canceled));
1736 if (canceled) { 1739 if (canceled) {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 blink::WebConsoleMessage::LevelWarning, message)); 2345 blink::WebConsoleMessage::LevelWarning, message));
2343 return false; 2346 return false;
2344 } 2347 }
2345 2348
2346 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2349 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2347 // Reset counter on successful print. 2350 // Reset counter on successful print.
2348 count_ = 0; 2351 count_ = 0;
2349 } 2352 }
2350 2353
2351 } // namespace printing 2354 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698