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

Issue 255543006: Printing on Windows via PDF (Closed)

Created:
6 years, 8 months ago by scottmg
Modified:
6 years, 7 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Printing on Windows via PDF Currently: - Based on #if, switches renderer rendering to PDF for preview - Add PdfToEmfConvert based on PWGRasterConverter - Various plumbing. Preview works the same as other PDF based platforms. For getting to EMF, the when PRINTING_WIN_USES_PDF_AS_METAFILE is on, the renderer generates a PDF instead of EMF directly (this contains all the pages in the desired range). This is returned to PrintViewManagerBase, where it's passed to PdfToEmfConverter which uses the sandboxed utility process and pdf.dll to convert via RenderPDFPageToDC. The utility process renderers one emf page at at time (into numbered files) to avoid having a very large emf file. As this uses pdf.dll this is currently off-by-default controlled by the gyp variable win_pdf_metafile_for_printing. R=vitalybuka@chromium.org BUG=170859 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=271772

Patch Set 1 #

Patch Set 2 : start looking at service process #

Total comments: 9

Patch Set 3 : wip on using PdfToEmfConverter #

Patch Set 4 : almost working-ish, but no call ipc to actual convert #

Patch Set 5 : almost working; SafePlayback failing in final print #

Total comments: 10

Patch Set 6 : fix print area #

Patch Set 7 : . #

Patch Set 8 : switch to file write instead of handle to avoid alloc #

Patch Set 9 : set actual_shrink to valid value #

Patch Set 10 : add unit test for base additions #

Patch Set 11 : fix preview scaling, real print still wrong #

Patch Set 12 : wip, pass scale_factor back #

Patch Set 13 : rebase #

Patch Set 14 : try mac-like path instead #

Patch Set 15 : sandbox and comment on reason #

Patch Set 16 : work on doing a batch, but seems a bit complicated #

Patch Set 17 : batch pages of pdf in renderer #

Patch Set 18 : tidy #

Total comments: 28

Patch Set 19 : review fixes #

Total comments: 2

Patch Set 20 : cloud print and converter refactor #

Total comments: 2

Patch Set 21 : remove unused prototype #

Patch Set 22 : add todo #

Patch Set 23 : rebase #

Patch Set 24 : non-win #

Patch Set 25 : android #

Patch Set 26 : unused var warning #

Total comments: 19

Patch Set 27 : review fixes 2 #

Patch Set 28 : remove ref to internal_pdf and rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+635 lines, -168 lines) Patch
M build/common.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 3 chunks +7 lines, -0 lines 0 comments Download
A chrome/browser/printing/pdf_to_emf_converter.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +38 lines, -0 lines 0 comments Download
A + chrome/browser/printing/pdf_to_emf_converter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 6 chunks +103 lines, -83 lines 0 comments Download
M chrome/browser/printing/print_view_manager_base.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +14 lines, -1 line 0 comments Download
M chrome/browser/printing/print_view_manager_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 chunks +71 lines, -14 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_renderer.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +9 lines, -1 line 0 comments Download
M chrome/common/chrome_utility_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +8 lines, -7 lines 0 comments Download
M chrome/renderer/printing/print_web_view_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +10 lines, -1 line 0 comments Download
M chrome/renderer/printing/print_web_view_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +3 lines, -2 lines 0 comments Download
A chrome/renderer/printing/print_web_view_helper_pdf_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +294 lines, -0 lines 0 comments Download
M chrome/service/service_utility_process_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/service/service_utility_process_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 4 chunks +23 lines, -29 lines 0 comments Download
M chrome/utility/chrome_content_utility_client.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 2 chunks +5 lines, -2 lines 0 comments Download
M chrome/utility/chrome_content_utility_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 5 chunks +40 lines, -22 lines 0 comments Download
M content/renderer/pepper/pepper_plugin_instance_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -1 line 0 comments Download
M printing/metafile_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
Vitaly Buka (NO REVIEWS)
Approach looks good, maybe the simplest way to achieve results. https://codereview.chromium.org/255543006/diff/40001/chrome/browser/printing/print_view_manager_base.cc File chrome/browser/printing/print_view_manager_base.cc (right): https://codereview.chromium.org/255543006/diff/40001/chrome/browser/printing/print_view_manager_base.cc#newcode557 ...
6 years, 8 months ago (2014-04-24 22:47:57 UTC) #1
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/255543006/diff/40001/chrome/browser/printing/print_view_manager_base.cc File chrome/browser/printing/print_view_manager_base.cc (right): https://codereview.chromium.org/255543006/diff/40001/chrome/browser/printing/print_view_manager_base.cc#newcode562 chrome/browser/printing/print_view_manager_base.cc:562: page_ranges)) { It's going to be harder then I ...
6 years, 8 months ago (2014-04-25 05:25:47 UTC) #2
scottmg
Thanks! This is almost working now; the pdf is rendered, converted to emf in the ...
6 years, 8 months ago (2014-04-25 20:47:18 UTC) #3
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/255543006/diff/90001/chrome/browser/printing/print_view_manager_base.cc File chrome/browser/printing/print_view_manager_base.cc (right): https://codereview.chromium.org/255543006/diff/90001/chrome/browser/printing/print_view_manager_base.cc#newcode137 chrome/browser/printing/print_view_manager_base.cc:137: PrintedDocument* document = print_job_->document(); this metafile could be multi ...
6 years, 8 months ago (2014-04-25 22:35:24 UTC) #4
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/255543006/diff/90001/chrome/browser/printing/print_view_manager_base.cc File chrome/browser/printing/print_view_manager_base.cc (right): https://codereview.chromium.org/255543006/diff/90001/chrome/browser/printing/print_view_manager_base.cc#newcode137 chrome/browser/printing/print_view_manager_base.cc:137: PrintedDocument* document = print_job_->document(); On 2014/04/25 22:35:24, Vitaly Buka ...
6 years, 8 months ago (2014-04-25 22:42:15 UTC) #5
scottmg
https://codereview.chromium.org/255543006/diff/90001/chrome/browser/printing/print_view_manager_base.cc File chrome/browser/printing/print_view_manager_base.cc (right): https://codereview.chromium.org/255543006/diff/90001/chrome/browser/printing/print_view_manager_base.cc#newcode137 chrome/browser/printing/print_view_manager_base.cc:137: PrintedDocument* document = print_job_->document(); On 2014/04/25 22:35:24, Vitaly Buka ...
6 years, 8 months ago (2014-04-25 22:45:10 UTC) #6
scottmg
https://codereview.chromium.org/255543006/diff/90001/chrome/utility/chrome_content_utility_client.cc File chrome/utility/chrome_content_utility_client.cc (right): https://codereview.chromium.org/255543006/diff/90001/chrome/utility/chrome_content_utility_client.cc#newcode737 chrome/utility/chrome_content_utility_client.cc:737: CHECK_EQ(static_cast<int>(final_size), On 2014/04/25 22:35:24, Vitaly Buka wrote: > This ...
6 years, 8 months ago (2014-04-25 23:07:18 UTC) #7
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/255543006/diff/90001/chrome/utility/chrome_content_utility_client.cc File chrome/utility/chrome_content_utility_client.cc (right): https://codereview.chromium.org/255543006/diff/90001/chrome/utility/chrome_content_utility_client.cc#newcode737 chrome/utility/chrome_content_utility_client.cc:737: CHECK_EQ(static_cast<int>(final_size), It's not about rasterize. You don't need to ...
6 years, 8 months ago (2014-04-28 06:47:32 UTC) #8
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/255543006/diff/90001/chrome/utility/chrome_content_utility_client.cc File chrome/utility/chrome_content_utility_client.cc (right): https://codereview.chromium.org/255543006/diff/90001/chrome/utility/chrome_content_utility_client.cc#newcode737 chrome/utility/chrome_content_utility_client.cc:737: CHECK_EQ(static_cast<int>(final_size), base::WritePlatformFile -> base::WritePlatformFileAtCurrentPos to append On 2014/04/28 06:47:33, ...
6 years, 8 months ago (2014-04-28 06:49:06 UTC) #9
scottmg
OK, this finally works enough to be worth reviewing now. I'm sorry it got so ...
6 years, 7 months ago (2014-05-13 22:37:13 UTC) #10
Vitaly Buka (NO REVIEWS)
no need to break it up lgtm with some nits and some questions https://codereview.chromium.org/255543006/diff/400001/chrome/browser/printing/pdf_to_emf_converter.cc File ...
6 years, 7 months ago (2014-05-13 23:54:32 UTC) #11
scottmg
Thanks for the quick review! Couple questions for follow up. https://codereview.chromium.org/255543006/diff/400001/chrome/browser/printing/pdf_to_emf_converter.cc File chrome/browser/printing/pdf_to_emf_converter.cc (right): https://codereview.chromium.org/255543006/diff/400001/chrome/browser/printing/pdf_to_emf_converter.cc#newcode200 ...
6 years, 7 months ago (2014-05-14 00:34:48 UTC) #12
Vitaly Buka (NO REVIEWS)
https://codereview.chromium.org/255543006/diff/400001/chrome/browser/printing/pdf_to_emf_converter.cc File chrome/browser/printing/pdf_to_emf_converter.cc (right): https://codereview.chromium.org/255543006/diff/400001/chrome/browser/printing/pdf_to_emf_converter.cc#newcode228 chrome/browser/printing/pdf_to_emf_converter.cc:228: // gdiplus.dll, change how rendering happens, and not be ...
6 years, 7 months ago (2014-05-14 03:51:17 UTC) #13
scottmg
Sorry for the delay, was out yesterday. Please take another look. https://codereview.chromium.org/255543006/diff/400001/chrome/common/chrome_utility_messages.h File chrome/common/chrome_utility_messages.h (right): ...
6 years, 7 months ago (2014-05-15 18:01:30 UTC) #14
Vitaly Buka (NO REVIEWS)
lgtm https://codereview.chromium.org/255543006/diff/500001/chrome/utility/chrome_content_utility_client.cc File chrome/utility/chrome_content_utility_client.cc (right): https://codereview.chromium.org/255543006/diff/500001/chrome/utility/chrome_content_utility_client.cc#newcode586 chrome/utility/chrome_content_utility_client.cc:586: Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_Succeeded( So how about sending ChromeUtilityHostMsg_RenderPDFPageToMetafiles_Succeeded message ...
6 years, 7 months ago (2014-05-15 19:23:33 UTC) #15
scottmg
Thanks, adding some other OWNERS: jschuh: chrome/common/chrome_utility_messages.h thestig: chrome/utility/chrome_content_utility_client.* raymes: content/renderer/pepper/pepper_plugin_instance_impl.cc https://codereview.chromium.org/255543006/diff/500001/chrome/utility/chrome_content_utility_client.cc File chrome/utility/chrome_content_utility_client.cc (right): ...
6 years, 7 months ago (2014-05-15 19:43:03 UTC) #16
Vitaly Buka (NO REVIEWS)
On 2014/05/15 19:43:03, scottmg wrote: > Thanks, adding some other OWNERS: > > jschuh: chrome/common/chrome_utility_messages.h ...
6 years, 7 months ago (2014-05-15 20:23:44 UTC) #17
jschuh
ipc security lgtm (notes: no change in attack surface)
6 years, 7 months ago (2014-05-15 20:31:19 UTC) #18
scottmg
On 2014/05/15 20:23:44, Vitaly Buka wrote: > On 2014/05/15 19:43:03, scottmg wrote: > > Thanks, ...
6 years, 7 months ago (2014-05-15 20:47:59 UTC) #19
Vitaly Buka (NO REVIEWS)
lgtm
6 years, 7 months ago (2014-05-15 20:51:03 UTC) #20
raymes
On 2014/05/15 20:51:03, Vitaly Buka wrote: > lgtm rubberstamp lgtm
6 years, 7 months ago (2014-05-16 01:00:39 UTC) #21
Lei Zhang
lgtm Mostly nits below. I was OOO for a few days, thus the delayed review. ...
6 years, 7 months ago (2014-05-20 03:39:28 UTC) #22
scottmg
Thanks! https://codereview.chromium.org/255543006/diff/630001/chrome/browser/printing/pdf_to_emf_converter.cc File chrome/browser/printing/pdf_to_emf_converter.cc (right): https://codereview.chromium.org/255543006/diff/630001/chrome/browser/printing/pdf_to_emf_converter.cc#newcode52 chrome/browser/printing/pdf_to_emf_converter.cc:52: return temp_dir_.path(); On 2014/05/20 03:39:29, Lei Zhang wrote: ...
6 years, 7 months ago (2014-05-20 17:16:24 UTC) #23
scottmg
The CQ bit was checked by scottmg@chromium.org
6 years, 7 months ago (2014-05-20 17:59:49 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/scottmg@chromium.org/255543006/670001
6 years, 7 months ago (2014-05-20 18:02:02 UTC) #25
commit-bot: I haz the power
6 years, 7 months ago (2014-05-20 22:02:29 UTC) #26
Message was sent while issue was closed.
Change committed as 271772

Powered by Google App Engine
This is Rietveld 408576698