Reputation: 2682
Sublime Text 2 seems like a great editor. I just started using it a week ago in eval mode and it doesn't seem to have any printing functionality. This seems preposterous to me, but I can't find it anywhere.
Is this a feature unlocked after purchase? I see no mention of that on the company website.
Can anyone help?
Upvotes: 216
Views: 187135
Reputation: 11
A workaround without installing any package :
Paragraph1 Paragraph2 Paragraph32. Just Add html and pre tag before and after your document like this
<html>
<pre>
Paragraph1
Paragraph2
Paragraph3
</pre>
</html>
Upvotes: 0
Reputation: 817
Still no print no native print function, but outside the installing the suggested package, you can go the autohotkey way, as the that app can actually help you run macros for other stuff as well. So you can do something like create a macro that with one click does:
No the most glamorous of options but could also work if the receiving app has can accept code-formatting.
Upvotes: 0
Reputation: 81
One way to print your code is to push it to an online version control system like Github or Bitbucket. In your browser, navigate to the file and print it.
Doing it this way, you'll get syntax highlighting and version control.
Upvotes: 1
Reputation: 4474
TL;DR Use Cmd/Ctrl+Shift+P
then Package Control: Install Package
, then Print to HTML
and install it. Use Alt+Shift+P
to print.
My favorite tool for printing from Sublime Text is Print to HTML package. You can "print" a selection or a whole file - via the web browser.
This opens your browser print dialog (Chrome for me) with the selected text neatly in the print dialog window and syntax highlighting intact. There you can choose a printer or export to PDF, and print.
Install the "Print to HTML" package using the package manager.
Ctrl + Shift + P
=> Gives a list of commands.install
"Package Control: Install Package
"print to
"Print to HTML
". Select that, and it is being installed.Alt+Shift+P
Upvotes: 33
Reputation: 2178
There is also the Simple Print package, which uses enscript to do the actual printing.
Similar to kenorb's answer, open the palette (ctrl/cmd+shift+p), "Install package", "Simple Print Function"
you MUST install enscript and here is how:
https://github.com/svenax/SublimePrint
Upvotes: 118
Reputation: 111366
UPDATE 2016: Somewhere between July 2015 and January 2016 the printing feature request that I wrote about in 2014 was removed. The original answer is below, with the relevant links changed to the latest working versions in the Web Archive:
Printing in Sublime Text is a feature that has been requested for about 4 years (as of 2014), with 1600+ supporting votes and 160+ comments in the discussion below. For something around 6000 feature requests this is in the top 5.
See the original, still open, feature request:
Judging from the feature request (still open with no official answer) it seems unlikely that printing will ever get implemented in version 3 (as others have suggested) or in any version at all.
The discussion below this feature request may give some insight on why printing is not supported and whether or not it has a chance to get supported in the future.
Maybe if more people vote or comment it will change in the future. (See Update 2016 below for an up-to-date list of feature requests)
Some workarounds were suggested, the most popular advices were to use some other editor for printing (eg. Brackets, Atom, gedit, Notepad++) or to use some 3rd party plugins that reportedly don't work well or at all.
In general there is a strong opposition to adding printing as a native feature of Sublime Text which for such a universal functionality among text editors seems surprising, but may nevertheless shed some light on this issue.
Meanwhile, there are many free editors that can print (in fact I cannot think of a single one that couldn't) so it is easy to use some other editor whenever a need for printing arises.
Since the feature request described above was removed (please comment if anyone knows why) here is an up-to-date list of some other places to find more info about printing in Sublime Text:
Since the original feature request #25170 was removed, you should vote and comment in the other feature requests about printing instead.
Upvotes: 26
Reputation: 22666
I like ExportHTML, which exports to html, opens it up in your browser, and optionally opens the system print dialog. Looks good, too. Not a perfect replacement for native printing, but pretty close.
Upvotes: 4
Reputation: 166467
Also see related printing forum topic: Printing from sublime
Upvotes: 11
Reputation: 88
Sorry to say that there is no print function in sublimetext2, may be 3 will fix this?
Anyway there are a few plugins that are floating about, the most helpful for you might be print-to-HTML https://github.com/joelpt/sublimetext-print-to-html .
Upvotes: 1
Reputation: 3283
This isn't supported yet. You can use plugins to export the text into HTML or RTF first, and then you can print it out, if you want.
Here is for example the SublimeHighlight plugin which you can use for exporting.
Upvotes: 86