Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Print API work on Windows. #1532

Merged
merged 3 commits into from
May 10, 2015
Merged

Make Print API work on Windows. #1532

merged 3 commits into from
May 10, 2015

Conversation

hokein
Copy link
Contributor

@hokein hokein commented Apr 30, 2015

The Print API(window.print()) on Windows will hang on printing spool(see #865). The reason is that Chromium doesn't generate the printed file content and keep waiting in a loop.

In the implementation, Chromium seperates a prcoess called Utility to do the printing work, so we need to custom the Utility process for Electron. On Windows, the print API relies on the pdf component which using to convert to EMF
(see https://code.google.com/p/chromium/issues/detail?id=170859). So we need to port pdf component in libchromiumcontent.

But there are something need to be considered. Introducing pdf component will make the release binary size larger. Is this reaonable? Or we can make the pdf as a seperated shared library(dll), and if developers don't need the print API, they can safely remove it in saving the binary size.

As a side effect, with pdf component, we may easyly support print to pdf and view pdf features.

This patch will rely on electron/libchromiumcontent#104, and fix #865.

Any comments and advice are welcomed.

TODO

  • API window.print() works. The printer will print the document correctly.
  • Pass component build(Dev build)
  • Pass non-component build(Release build)
  • Don't effect the OS X and Linux Platforms

@hokein
Copy link
Contributor Author

hokein commented Apr 30, 2015

Here are some output.

Print through PDFCreator:

image

Print through real printer

image

@anaisbetts
Copy link
Contributor

We would like to see printing / PDF support show up in Electron for sure, especially viewing PDFs

@zcbenz zcbenz mentioned this pull request May 5, 2015
@hokein
Copy link
Contributor Author

hokein commented May 5, 2015

@zcbenz
This PR is ready for review now. Before get merged, electron-archive/brightray#102 should be required to merge for component build.

@zcbenz
Copy link
Contributor

zcbenz commented May 10, 2015

Awesome!

v0.25.3 is released with PDF libraries, and the binary size is increased by about 14mb, I agree we should make it a DLL. We can probably patch libchromiumcontent to compile pdf target into a shared_library to make things easier.

zcbenz added a commit that referenced this pull request May 10, 2015
Make Print API work on Windows.
@zcbenz zcbenz merged commit 95e72c2 into electron:master May 10, 2015
zcbenz added a commit that referenced this pull request May 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

printing is broken on Windows
3 participants