Sublime Forum

Printing from sublime

#162

Yeah, there are multiple packages that allow printing. I’ve been printing from Sublime for quite a while with no issues. I don’t often print code, but it is super easy to. I mainly only print the occasional text documents or Markdown renders. I’m not sure why people even complain about this anymore as it is so easy to do.

0 Likes

#163

Well there you go. Exactly what I was talking about. As far as I am concerned Sublime Text doesn’t need anything more than this.

0 Likes

#164

My two cents: I like sublime a lot as a code editor but until printing is directly supported (as in not using a hack to print), I won’t purchase it. This is in essence a text editor. Printing isn’t an optional feature when editing text. I often find it useful to print things out when starting to work with someone else’s code or when I have a particularly difficult bug. Printed code lets you see a bigger picture of what is going on than a screen and it is easy to bookmark / annotate.

0 Likes

#165

Not trying to defend Sublime specifically and not trying to raise an argument but…

Vim, Emacs, Sublime Text, VSCode, Atom…probably the most popular text editors in the field of software development and none support printing without hacks or extensions/plugins. The most popular that I know of that supports printing is Notepad++. Looking at those I would surmise that the “not an optional feature” falls off pretty quick. You would like for your text editor to print and I get that. I also respect that, but you wanting something does not make it the industry standard unfortunately. Printing seems to be a feature more standard in IDEs than in text editors. Maybe Visual Studio would be a better fit for you. It is possible that you are not really looking for a text editor.

5 Likes

#166

Well, I was prepared to pay until I realized there is no print support. One of point of any feature is that the feature be there when you need it whether you need it often or not. I don’t frequently use many of Sublime Text’s features, but I like having them there for the rare occasions when I do need them. There is no credible argument for not including something as basic as printing.

0 Likes

#167

There is no credible argument for dismissing the counter arguments in this thread entirely without so much notice them.

2 Likes

#168

I found the points against print support in a text editor unconvincing. This addition should have been knocked out years ago.

Reasonable people can disagree. I’m happy to continue using the product without funding it until I see some print support. It’s one my favorite tools, and I have it open pretty much all day every workday.

1 Like

#169

Did you read the whole thread? A lot of people have already provided some solutions about how you can actually print stuff. If those solutions are still not “good” to you I’ll stick to what I said in a previous comment, users that want this feature to be implemented should explain carefully what the requirements are as there are many ways a “printing” feature in a text editor could be implemented. Some questions out of my head:

  • What would you want to print from a given view? I guess that text that fits in a chosen page size, right? And the page size would be computed out of the current font size? What about font outside the “page”?
  • Assuming we already know what content you want to print, how should be printed, should the theme be used or optional? Should the syntax highlighting apply in this context? Implementation if chosen one or another way will be pretty different

In any case, you can already export Sublime’s content to “printable” filfe formats and print stuff with suitable software so I don’t know why you guys want so badly this “must” feature.

As a coder, I find this feature to be totally out of scope from SublimeText… it’d be a huge waste of effort implementing something that can be already achieved instead investing time on the important matters… (IMHO)

5 Likes

#170

Noone disputes that coders are first-class citizens among SublimeText users. However, the editor isn’t Sublime Code, it’s Sublime Text – and the huge banner text on the homepage reads “A sophisticated text editor for code, markup and prose”.

※ That you personally use the text editor for a mere subset of its stated scope does not mean that printing is outside of that scope.

That said, here is a refinement using @mikeyww’s solution above and this technique for keybinding commands that need the filename.

Windows solution for printing in SublimeText
Supports spaces in filenames & doesn’t require changing build systems

  1. Download printText.exe , a small program which prints the (saved) text file whose path is passed in as an argument.

  2. Create a %appdata%\Sublime Text 3\Packages\User\print_with_printtext.py file, containing:

import sublime
import sublime_plugin

class PrintWithPrinttextCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		self.view.window().run_command('exec', {'cmd': "cmd /C \"\"c:\\your path\\goes here\\printtext.exe \" \"" + self.view.file_name() + "\""})
  • Change the path (c:\\your path\\goes here\\printtext.exe) according to your PrintText location
  • All backslashes must be escaped – i.e. convert \ to \\ in the path.
  1. Add { "keys": ["ctrl+p"], "command": "print_with_printtext" }, to the User file in Preferences > Key Bindings, so that you can print with CTRL-P.

Hope this helps someone.

I spent an afternoon fighting with the syntax of various commands (START, runas, powershell’s start-process, etc) until getting this one to work.

The reason we don’t simply launch PrintText.exe directly is that when invoked by Sublime Text, it positions its windows offscreen – and doesn’t actually fire the system’s print dialog until after its window actually draws.

0 Likes

#171

Just a quick note:

overriding Ctrl+P seems a bit overkill to me… better bind the cmd to another shortcut imho or you’ll lose native goTo functionality :wink:

0 Likes

#172

Look, long time coder. Love Sublime, used it for years, always hate that adding a print function somehow “slows down the program.” (Most popular opposite side opinion.) Really? All the other text editors, even the non-GUI ones can’t handle printing without interference to the app itself. Is it really so damned difficult to just include it native to call up the spooling resources of the machine it’s running on?

Everyone on here defending the opposite argument just seems like they’re whining about nothing. It’s a basic desire to want to print something for whatever reason we want, and the reasoning should not be up for debate. The main debate is TEN YEARS of people creating an account on this forum and voting up a SIMPLE print function be included native to the application, and for whatever reason the development team choosing not to include it because they mapped Ctrl/Command+P to native GoTo?

I get you wanna be different, but it’s going against ingrained behaviors for printing. Even if it’s not mapped to any keybind, it should still be an OPTION on the File Menu. If you don’t use it, you don’t use. You probably don’t use the entirety of what the application offers anyway. Why does it matter to argue about wanting to print a document?

All of the solutions are horrible workarounds. It should be as easy as File > Print and let us deal with the native dialogues and whatever formatting might occur from the OS. Would adding printing capabilities really hamper down this application? Really? Can you explain to me how an addition of this feature as native functionality would somehow degrade this application?

It’s 2020 in the middle of the coronavirus epidemic, and a program can’t print still? Eleven years. Listen to your user base much?

1 Like

#173

Have you read the 11 years worth of messages from people asking for this functionality? It’s that still a low priority?

0 Likes

#174

Extremely vocal minority, simple as that.

0 Likes

#175

You read that wrong. It is said to slow down development of other more widely available improvements or features that do not have an easy, simple and functioning workaround like printing.

5 Likes

#176

Printing for everyone via https://packagecontrol.io/packages/ExportHtml

7 Likes

#177

I can’t believe how many years people have been waiting for this fundamental functionality.
I like Sublime, and I use it, but I will not plunk down cash for an editor that can’t print. Sorry, I’m sticking with the eval version.

0 Likes

#179

That’s ok, because no-ones cares. Like 0.0000000001% of users want printing. What’s fundamental to you is irrelevant to almost everybody.

2 Likes

#180

You noticed that you are more or less saying:
“I like SublimeText (because it is great software and better than the free alternatives in many points) and will keep using it unlicensed (and thus violate the license) because it has not one single feature I want to have (printing support)”?

Interesting attitude imho…

4 Likes

#181

Oh well. You don’t like that? Then maybe they should ditch the eval version. It’s not worth eighty bucks to me.

0 Likes

#182

You insinuate that supporting printing would make it worth your money to follow the licensing terms. That’s the notion that has people making fun of you.

I think that’s absurd, and I made (and subsequently deleted) a post saying so, but other people have also cottoned to your inconsistency. If you wouldn’t follow the licensing terms without printing, there’s no chance you would with it.

4 Likes