-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
print - silent print [$100] #1263
Comments
+1 - We have an external cpp file to do this right now, pretty hacky. |
+1 Where I can vote for this feature? :) |
@jonathandelgado... is your external cpp file available to others? I've been working on a node module for extended printing support, and have added some functionality, but failed at actual silent printing of the page (I can send raw text). Will you share? |
Any updates on this? Anyone found any usable workarounds? |
+1 please |
Any news on that? Did @jonathandelgado offer some insights about his cpp file? |
No :( I still don't have a solution for this. I've written a node module that can provide a list of installed printers and print to one. Unfortunately for me, this falls short in that I need to print the current page as webkit would render it for the selected printer. If anyone has any creative ideas of how this may be done, please let me know. |
Oh, sorry, I unfollowed the issue and never got the notification, the mention pinged me. My issue with this was regarding receipts, not really html, so I was able to get by with the windows spool API in cpp. I eventually ended up moving over to a fully OPOS module, which works much better - but wouldn't help with printing HTML. I can't release code samples for either, sorry. In the end, this solution can only really be solved, in terms of html, my adding an additional JS API for both listing printers and initializing silent printing, which would call the functions from Good luck |
Thanks Jonathan, that's a great point in the right direction for me. |
I might take a look into https://github.com/tojocky/node-printer to overcome this. Sounds like a possible solution for silent printing. |
That project was the basis for my current module, and they've since added support for printing PDFs, but you'd need to know the paper size of the target printer to know what size PDF to generate, unless I'm missing something. I simply want to be able to window.print({ printer: "Brother HL2700", silent: true}). The path of least resistance to this or something functionally equivalent is what I'm looking for. |
yeah +1, I would really need that feature like now. ;) |
+1 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
To all the people requesting silent printing -- I'd love to support this. Does |
@rogerwang i would love this, for mr those switches would work :) |
Or maybe a --printing so you don t need kiosk mode |
@rogerwang That is an excellent first step. However, I think the majority of users requesting silent printing also need the ability to select a specific printer. There isn't a printer API in chromium, so that would have to be an external dependency. |
That would be fantastic! |
I work on Kiosk application and in deep need of good silent print support.
|
It is supported now by command line switch '--kiosk-printing' in 0.13 version |
@ahmedkandel Currently no.. But in Chromium upstream the feature is working by automatically confirm in the print preview WebUI, which is written in JS/HTML and builtin in the resource file in the release. If I enable a feature that the WebUI files can be override by you, so you can take the JS files for print preview from Chromium, modify it whatever you want, will that be good enough for you? See the JS files for print view here: https://github.com/nwjs/chromium.src/tree/nw13/chrome/browser/resources/print_preview |
would be a workaround but i prefer to wait for a more robust solution. please take your time thanks again. |
I hope this might help someone else. I needed silent printing in NWJS (Windows only) with the following requirements:
I was able to accomplish this via the following (general overview):
|
@acicali I have recently done very similar thing, but because of 3D transformations, I was not able to render proper PDF file. |
@Vandalko |
@acicali I've configured Windows default printer and IrfanView printing, and then: win.capturePage(function(img) {
var base64Data = img.replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
var fileName = printFolder + 'out-' + Date.now() + '.png';
require("fs").writeFile(fileName, base64Data, 'base64', function(err) {
if (err) {
winston.error('Print error', {error: err});
}
var iPrint = spawn('C:\\Program Files (x86)\\IrfanView\\i_view32.exe', [fileName, '/print']);
iPrint.on('close', function(code) {
winston.info('IrfanView exit code: ' + code);
var maxWaiting = global.konfig.printTime;
var timeout = maxWaiting - (Date.now() - model.startTime);
setTimeout(function() {
global.printDone();
}, Math.min(Math.max(timeout, 0), maxWaiting));
});
});
}, 'png'); |
@rogerwang do you have any idea about the possibility to customize/override the print_preview webUI and default preferences? |
@AndryBray my last proposal is to provide a way that developer can override the webUI by copying chrome/browser/resources/print_preview tree to somewhere under the application's directory and then modify it. Does that sound good to you? Of course we would like to provide some API for this later, but the override way is straightforward in implementation. |
@rogerwang Yes it could be a perfect solution, the most important is to let us interact with default html & js files so we could be able to change behavior of chrome preview. How long does this task take? Is it possibile to have some preview on next nw15? thanks a lot!!! |
Yeah, will see this in 0.15.0 or 0.15.1 as Chromium 51 will be released soon in ~ 1 week. |
Great! Please, could you do the same for nwjs 0.14 ? It's important because of XP and legacy MacOS versions support. Thank you |
@AndryBray yeah, as we announced 0.14 will be under development with new features in at least one year. |
@rogerwang You rock man! |
@AndryBray I've done the overriding part but unfortunately the HTML file in that directory is not real HTML. It has tags like |
Oh no!
|
@rogerwang do you think is a kind of API doable in short time? Thank you |
@AndryBray currently I'm not sure how long it will take. At least it's longer than the previous proposal. If it's really urgent on your side, perhaps just change the preview UI files and rebuild NW would be the fastest way. |
Any news about silent printing, im actually waiting for the release. |
@jasminmif see my previous comment #1263 (comment) for silent printing. To all: I'm closing this issue and opened a new issue for custom printing API #4911 |
@rogerwang Can you please provide a sample code of --kiosk printing, where should i add that option cause its very unclear ? And is there a way to select a specific printer to print the document ?
|
@jasminmif the argument is used in command line when you launch NW.js |
NW v0.14.6 LTS released with custom printing API http://nwjs.io/blog/v0.14.6/ . Please follow up in #4911 |
I solved it in the package.json with the command: "chromium-args":"--kiosk-printing", and my file let as follows: |
Hi,
about the printing functionality is it stable now and mature, then i wan to ask how can i silent print the page some thing like chromes --kiosk --kiosk-printing. thanks
There is a $100 open bounty on this issue. Add to the bounty at Bountysource.
The text was updated successfully, but these errors were encountered: