Daniel Protopopov
Daniel Protopopov

Reputation: 7236

Programmatically print HTML file for Chrome

I have an HTML file with inline styles that looks and prints perfectly fine when I open it and do printing as usual from Chrome. The question is this - how do I do a silent print from inside the Chrome, granted it has the prophecies printing output I need? I have tried using WebBrowe0ser, but that's IE - not Chrome! I also tried doing it the console command way - print /D:"my printer" myfile, but that prints the source of the file, not rendering of it. I have tried many other options - using WebBrowser is not too bad, granted it does not handle page-break-after that well, BUT I want to know how to do silent printing of a file with Chrome rendering, from a console application for example. How would I go about getting there? I seen and will try using CEF, but to print without dialogue I will have to tinker with the source code and compile it first...

Any suggestions?

Upvotes: 1

Views: 1909

Answers (1)

Gideon Pyzer
Gideon Pyzer

Reputation: 23958

Check out the Electron cross-platform framework, which is based on Chromium. In particular, the printing options found on webContents from the BrowserWindow module. It looks promising to me!

Upvotes: 2

Related Questions