Printing support


There is an npm package for printing on any OS: node-printer. I tried to get it to work and had trouble building it. I should try it again. I think I had setup problems with GYP.


I got to install, what next? Some kind of package that puts a menu item under File, then reades the active tab?


I can write a package to use that. If you want black-and white text I could have it working in a few hours. Color highlighted would take a few days. I’ll try to get to the B/W version tomorrow.

Edit: of course if can write a package that would be even better. (grin)


For what it’s worth, since window.print appears to work in atom shell, you can do this:

_ = require 'lodash'

atom.commands.add 'atom-workspace', 'editor:print', ->
	iframe = document.createElement('iframe') = 'hidden' = 'fixed' = 0 = 0


	editor = atom.workspace.getActiveTextEditor()
	text = editor.getText()
	html = "<pre>#{_.escape text}</pre>"


	close = ->

	iframe.contentWindow.onbeforeunload = close
	iframe.contentWindow.onafterprint = close

No need for node modules. This doesn’t include syntax highlighting, which is a bit more involved.


Only because it needs more work, right? I wonder if one could just clone the texteditor DOM fragment.


Lines are only in the DOM when they’re visible. The best option is probably to rebuild the HTML from tokenized source.

I made a simple package but I haven’t published it yet, try it out

It builds the HTML and puts it in a shadow root with the current syntax theme.

Print functionality?

No problem, just programmatically scroll through the editor and clone the lines into the iframe in any order.

Aweome. Looking forward to using it.


I’m shocked and saddened! this is 2015?


30 years ago we had to print out stuff. Now print is dead. Actually 30 years ago the ghostbuster pronounced print as dead. He was just a bit ahead of his time.

I haven’t printed anything in a year or two.


I keep trying to get my daughter to take my LaserJet something-or-other from 1999 away so I don’t have to keep it in my office anymore :laughing:


for someone like me, with a handicap…printing is a boon under certain situations.

I cannot implement this is atom…but I would really appreciate it if someone did develop this printing capability


Did you try the package @postcasio mentioned above?


I can’t find atom-printer in the package search. (not found)

Am I looking in the wrong place?


It was never released. The source of the package is still available though.


so what should we do?

For me Atom is a Sublime kller but I still have to copy and past to TextEdit to print stuff. That is awkward. :-/


Someone can take up the baton and make the package work. Or someone could create a new package that offers the functionality.


+1 for printing support as a feature request. When I can open up vi/vim and run :!lpr, it’s really hard to justify switching to Atom as my text editor. There’s more to a text editor than coding and revision control, after all.



Yes–someone could contribute this as an add-on package, but I’d like to see it built into the editor or at least a package provided and supported by the Atom team itself. That way it stays supported when user X goes on vacation or loses interest.

Edit: The relevant GitHub issue seems to be

and is blocked pending improvements under Windows.


I chatted with members of the team and they don’t have the staff to support all the packages/features everyone wants. That is why they designed atom to be extensible in the first place. If enough users want a feature then it will be supported in the long run. So far there doesn’t seem to be much interest in printing

Who supports VIM? I would expect Atom to pick up wide support as the user base grows and it is growing like crazy right now.


I fixed the code of the atom-printer package: It works, but I am not really impressed with the results:

  • Syntax highlighting meant for a dark theme looks bad on paper, it needs a separate theme setting for printing only.
  • Themes rely on particular elements to be present in the document. Without them, the font isn’t right - and I’m fairly certain that there are other subtle issues as well.
  • Printing a large document by generating an HTML document for it all at once is bound to cause extended hangs.
  • The title of the document is bogus, this could probably be alleviated by adding a <title> tag to the frame.
  • Per-print configuration is important, e.g. to support optional line numbers - yet I don’t think that extending the Print dialog is currently possible.

All in all, printing support isn’t really easy.

Ability to print