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

Issue 2524143003: Print Preview: Add option to rasterize PDFs and add JPEG compression. (Closed)

Created:
4 years ago by rbpotter
Modified:
3 years, 10 months ago
CC:
arv+watch_chromium.org, blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, jam, mlamouri+watch-content_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Print Preview: Add option to rasterize PDFs and add JPEG compression. Add checkbox to print preview to select rasterized PDF output. When selected, PDF will be rasterized and printed as a series of images. Images will be JPEG encoded. Preliminary design doc: https://docs.google.com/a/google.com/document/d/1UTzurMuPeRgx2PcnTMuAq5iM5_R2QBNGp-9lzgtwT2k/edit?usp=sharing Depends on http://crrev.com/2529543003 Linked to launch bug, should also resolve 534945,550205,480628 BUG=675798 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/0fab356029c629728da6de182da3500661778b3c Cr-Commit-Position: refs/heads/master@{#440897}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Add file #

Patch Set 3 : Reduce diff #

Patch Set 4 : Fix bug #

Patch Set 5 : Reduce diff #

Patch Set 6 : Fix Tests #

Patch Set 7 : Rebase #

Patch Set 8 : Update string to match UX recommendation #

Patch Set 9 : Reduce diff #

Patch Set 10 : Change to match new Pdfium API #

Total comments: 36

Patch Set 11 : Fix pdfium engine and javascript #

Total comments: 6

Patch Set 12 : Remove unnecessary struct and variable #

Total comments: 6

Patch Set 13 : Fix initialization #

Total comments: 2

Patch Set 14 : Merge in Javascript Other Options #

Patch Set 15 : Add comment back #

Total comments: 3

Patch Set 16 : Add flag #

Total comments: 6

Patch Set 17 : Clean up JS #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+287 lines, -51 lines) Patch
M chrome/app/generated_resources.grd View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +10 lines, -1 line 0 comments Download
M chrome/browser/about_flags.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/resources/print_preview/data/print_ticket_store.js View 2 chunks +12 lines, -0 lines 0 comments Download
A chrome/browser/resources/print_preview/data/ticket_items/rasterize.js View 1 2 3 4 5 6 7 8 9 10 1 chunk +50 lines, -0 lines 0 comments Download
M chrome/browser/resources/print_preview/native_layer.js View 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/resources/print_preview/preview_generator.js View 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/resources/print_preview/previewarea/preview_area.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/print_preview/print_preview.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/resources/print_preview/settings/other_options_settings.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/resources/print_preview/settings/other_options_settings.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +25 lines, -12 lines 0 comments Download
M chrome/browser/ui/webui/print_preview/print_preview_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/print_preview/print_preview_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/common/chrome_features.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/chrome_features.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/test/data/webui/print_preview.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 5 chunks +20 lines, -3 lines 0 comments Download
M components/printing/browser/print_manager_utils.cc View 1 chunk +1 line, -0 lines 0 comments Download
M components/printing/common/print_messages.h View 1 2 chunks +4 lines, -0 lines 1 comment Download
M components/printing/common/print_messages.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +22 lines, -20 lines 0 comments Download
M components/printing/renderer/print_web_view_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/pepper/pepper_plugin_instance_impl.h View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M content/renderer/pepper/pepper_plugin_instance_impl.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +14 lines, -5 lines 1 comment Download
M pdf/pdfium/DEPS View 1 chunk +1 line, -0 lines 1 comment Download
M pdf/pdfium/pdfium_engine.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +43 lines, -6 lines 1 comment Download
M printing/print_job_constants.h View 1 chunk +1 line, -0 lines 0 comments Download
M printing/print_job_constants.cc View 1 chunk +3 lines, -0 lines 1 comment Download
M printing/print_settings.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -0 lines 0 comments Download
M printing/print_settings_conversion.cc View 3 chunks +4 lines, -2 lines 0 comments Download
M printing/printing_context.cc View 1 chunk +1 line, -0 lines 0 comments Download
M testing/variations/fieldtrial_testing_config.json View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +18 lines, -0 lines 0 comments Download
M third_party/WebKit/public/web/WebPrintParams.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +3 lines, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +4 lines, -0 lines 0 comments Download

Messages

Total messages: 94 (64 generated)
rbpotter
4 years ago (2016-12-13 20:33:07 UTC) #26
dpapad
https://codereview.chromium.org/2524143003/diff/180001/chrome/browser/resources/print_preview/data/ticket_items/rasterize.js File chrome/browser/resources/print_preview/data/ticket_items/rasterize.js (right): https://codereview.chromium.org/2524143003/diff/180001/chrome/browser/resources/print_preview/data/ticket_items/rasterize.js#newcode20 chrome/browser/resources/print_preview/data/ticket_items/rasterize.js:20: this, null /*appState*/, null /*field*/, destinationStore, Nit: Add spaces ...
4 years ago (2016-12-13 23:38:18 UTC) #33
dsinclair
tsepez@ can you take a quick look at the bits in pdfium_engine? https://codereview.chromium.org/2524143003/diff/180001/pdf/pdfium/pdfium_engine.cc File pdf/pdfium/pdfium_engine.cc ...
4 years ago (2016-12-14 19:54:39 UTC) #35
Tom Sepez
https://codereview.chromium.org/2524143003/diff/180001/pdf/pdfium/pdfium_engine.cc File pdf/pdfium/pdfium_engine.cc (right): https://codereview.chromium.org/2524143003/diff/180001/pdf/pdfium/pdfium_engine.cc#newcode1357 pdf/pdfium/pdfium_engine.cc:1357: if (!HasPermission(PDFEngine::PERMISSION_PRINT_LOW_QUALITY)) nit: Can a document have high_quality but ...
4 years ago (2016-12-14 20:32:55 UTC) #36
Tom Sepez
https://codereview.chromium.org/2524143003/diff/180001/pdf/pdfium/pdfium_engine.cc File pdf/pdfium/pdfium_engine.cc (right): https://codereview.chromium.org/2524143003/diff/180001/pdf/pdfium/pdfium_engine.cc#newcode1463 pdf/pdfium/pdfium_engine.cc:1463: buffer.data = new uint8_t[buffer.size]; actually, we can set buffer.data ...
4 years ago (2016-12-14 20:36:28 UTC) #37
rbpotter
https://codereview.chromium.org/2524143003/diff/180001/chrome/browser/resources/print_preview/data/ticket_items/rasterize.js File chrome/browser/resources/print_preview/data/ticket_items/rasterize.js (right): https://codereview.chromium.org/2524143003/diff/180001/chrome/browser/resources/print_preview/data/ticket_items/rasterize.js#newcode20 chrome/browser/resources/print_preview/data/ticket_items/rasterize.js:20: this, null /*appState*/, null /*field*/, destinationStore, On 2016/12/13 23:38:18, ...
4 years ago (2016-12-15 00:50:59 UTC) #38
dpapad
https://codereview.chromium.org/2524143003/diff/200001/chrome/browser/resources/print_preview/settings/other_options_settings.js File chrome/browser/resources/print_preview/settings/other_options_settings.js (right): https://codereview.chromium.org/2524143003/diff/200001/chrome/browser/resources/print_preview/settings/other_options_settings.js#newcode8 chrome/browser/resources/print_preview/settings/other_options_settings.js:8: function CheckboxTicketItemElement(ticketItem, collapsible, className) { This looks like a ...
4 years ago (2016-12-15 01:17:50 UTC) #39
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/2524143003/diff/1/pdf/pdfium/pdfium_engine.cc File pdf/pdfium/pdfium_engine.cc (right): https://codereview.chromium.org/2524143003/diff/1/pdf/pdfium/pdfium_engine.cc#newcode1494 pdf/pdfium/pdfium_engine.cc:1494: // encode_success = false; please remove https://codereview.chromium.org/2524143003/diff/1/pdf/pdfium/pdfium_engine.cc#newcode1572 pdf/pdfium/pdfium_engine.cc:1572: for ...
4 years ago (2016-12-15 08:27:34 UTC) #40
dsinclair
pdf/ changes lgtm
4 years ago (2016-12-15 18:57:32 UTC) #41
Tom Sepez
https://codereview.chromium.org/2524143003/diff/180001/pdf/pdfium/pdfium_engine.cc File pdf/pdfium/pdfium_engine.cc (right): https://codereview.chromium.org/2524143003/diff/180001/pdf/pdfium/pdfium_engine.cc#newcode1357 pdf/pdfium/pdfium_engine.cc:1357: if (!HasPermission(PDFEngine::PERMISSION_PRINT_LOW_QUALITY)) On 2016/12/15 00:50:59, rbpotter wrote: > On ...
4 years ago (2016-12-15 21:09:23 UTC) #42
rbpotter
https://codereview.chromium.org/2524143003/diff/1/pdf/pdfium/pdfium_engine.cc File pdf/pdfium/pdfium_engine.cc (right): https://codereview.chromium.org/2524143003/diff/1/pdf/pdfium/pdfium_engine.cc#newcode1494 pdf/pdfium/pdfium_engine.cc:1494: // encode_success = false; On 2016/12/15 08:27:34, Vitaly Buka ...
4 years ago (2016-12-16 00:06:31 UTC) #44
Vitaly Buka (NO REVIEWS)
are there any tests which could be extended?
4 years ago (2016-12-16 00:25:22 UTC) #45
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/2524143003/diff/220001/content/renderer/pepper/pepper_plugin_instance_impl.cc File content/renderer/pepper/pepper_plugin_instance_impl.cc (right): https://codereview.chromium.org/2524143003/diff/220001/content/renderer/pepper/pepper_plugin_instance_impl.cc#newcode1784 content/renderer/pepper/pepper_plugin_instance_impl.cc:1784: *format = PP_PRINTOUTPUTFORMAT_RASTER; It should be PP_PRINTOUTPUTFORMAT_PDF as it's ...
4 years ago (2016-12-16 00:54:38 UTC) #46
rbpotter
Re: extending tests, I have already extended the relevant javascript capabilities tests to check the ...
4 years ago (2016-12-16 01:14:33 UTC) #47
Vitaly Buka (NO REVIEWS)
Please point attention of bbudge@ and raymes@ to PP_PRINTOUTPUTFORMAT_RASTER vs PP_PRINTOUTPUTFORMAT_PDF. I am not sure ...
4 years ago (2016-12-16 01:33:54 UTC) #49
dcheng
I'm not sure what I'm supposed to review. Under the assumption that it's just WebKit, ...
4 years ago (2016-12-16 01:44:27 UTC) #50
rbpotter
On 2016/12/16 01:44:27, dcheng wrote: > I'm not sure what I'm supposed to review. Under ...
4 years ago (2016-12-16 01:55:53 UTC) #51
bbudge
It looks like the intent is to force the Pepper plugin to rasterize rather than ...
4 years ago (2016-12-16 01:58:40 UTC) #52
dcheng
ipc lgtm as well
4 years ago (2016-12-16 08:51:08 UTC) #53
Tom Sepez
lgtm
4 years ago (2016-12-16 18:32:21 UTC) #54
rbpotter
Merged in the newly landed other_options_settings.js modifications (changes only print preview javascript files).
4 years ago (2016-12-16 22:01:14 UTC) #56
dpapad
LGTM. https://codereview.chromium.org/2524143003/diff/280001/chrome/browser/resources/print_preview/settings/other_options_settings.html File chrome/browser/resources/print_preview/settings/other_options_settings.html (right): https://codereview.chromium.org/2524143003/diff/280001/chrome/browser/resources/print_preview/settings/other_options_settings.html#newcode6 chrome/browser/resources/print_preview/settings/other_options_settings.html:6: <div class="right-column checkbox"> I don't think that "checkbox" ...
4 years ago (2016-12-17 01:19:03 UTC) #60
rbpotter
Added a flag. Flag modifications affect only JS/webui and the histograms/chrome_features/testing files. Also followed suggestion ...
4 years ago (2016-12-20 22:41:05 UTC) #67
Ilya Sherman
histograms.xml and fieldtrial_testing_config LGTM. FWIW, you don't need to add the fieldtrial_testing_config until you are ...
4 years ago (2016-12-21 03:25:54 UTC) #71
dpapad
printPdfAsImageEnabled JS changes: still LGTM. https://codereview.chromium.org/2524143003/diff/320001/chrome/browser/resources/print_preview/settings/other_options_settings.js File chrome/browser/resources/print_preview/settings/other_options_settings.js (right): https://codereview.chromium.org/2524143003/diff/320001/chrome/browser/resources/print_preview/settings/other_options_settings.js#newcode151 chrome/browser/resources/print_preview/settings/other_options_settings.js:151: new CheckboxTicketItemElement(headerFooter, true, Nit: ...
4 years ago (2016-12-22 19:27:00 UTC) #75
rbpotter
https://codereview.chromium.org/2524143003/diff/320001/chrome/browser/resources/print_preview/settings/other_options_settings.js File chrome/browser/resources/print_preview/settings/other_options_settings.js (right): https://codereview.chromium.org/2524143003/diff/320001/chrome/browser/resources/print_preview/settings/other_options_settings.js#newcode151 chrome/browser/resources/print_preview/settings/other_options_settings.js:151: new CheckboxTicketItemElement(headerFooter, true, On 2016/12/22 19:27:00, dpapad wrote: > ...
4 years ago (2016-12-22 22:58:46 UTC) #78
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2524143003/340001
3 years, 11 months ago (2016-12-28 21:55:58 UTC) #87
commit-bot: I haz the power
Committed patchset #17 (id:340001)
3 years, 11 months ago (2016-12-28 22:01:02 UTC) #90
commit-bot: I haz the power
Patchset 17 (id:??) landed as https://crrev.com/0fab356029c629728da6de182da3500661778b3c Cr-Commit-Position: refs/heads/master@{#440897}
3 years, 11 months ago (2017-01-02 15:50:28 UTC) #92
Lei Zhang
3 years, 10 months ago (2017-02-25 01:01:17 UTC) #94
Message was sent while issue was closed.
Just being nitty.

https://codereview.chromium.org/2524143003/diff/340001/components/printing/co...
File components/printing/common/print_messages.h (right):

https://codereview.chromium.org/2524143003/diff/340001/components/printing/co...
components/printing/common/print_messages.h:132: // Whether to rasterize a PDF
for printing
Move this down below line 144 somewhere?

https://codereview.chromium.org/2524143003/diff/340001/content/renderer/peppe...
File content/renderer/pepper/pepper_plugin_instance_impl.cc (right):

https://codereview.chromium.org/2524143003/diff/340001/content/renderer/peppe...
content/renderer/pepper/pepper_plugin_instance_impl.cc:1793: params.rasterizePDF
= false;
BTW, this is already initialized to false in the member declaration.

https://codereview.chromium.org/2524143003/diff/340001/pdf/pdfium/DEPS
File pdf/pdfium/DEPS (right):

https://codereview.chromium.org/2524143003/diff/340001/pdf/pdfium/DEPS#newcode8
pdf/pdfium/DEPS:8: "+ui/gfx/codec/jpeg_codec.h",
nit: sort

https://codereview.chromium.org/2524143003/diff/340001/pdf/pdfium/pdfium_engi...
File pdf/pdfium/pdfium_engine.cc (right):

https://codereview.chromium.org/2524143003/diff/340001/pdf/pdfium/pdfium_engi...
pdf/pdfium/pdfium_engine.cc:1446: int quality = 40;
const + add comment to mention why we chose 40.

https://codereview.chromium.org/2524143003/diff/340001/printing/print_job_con...
File printing/print_job_constants.cc (right):

https://codereview.chromium.org/2524143003/diff/340001/printing/print_job_con...
printing/print_job_constants.cc:175: // Scaling factor
Copy pasta

Powered by Google App Engine
This is Rietveld 408576698