5

I'm going to a farm. I think there are no computers there, and my laptop is broken. I want to print out the code of some of my projects on A4 paper so I can review it while I'm there. It would be nice if it was printed with syntax highlighting.

Editors: Vim, Notepad++

Code: Html, CSS, Javascript

Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
alexchenco
  • 53,565
  • 76
  • 241
  • 413

5 Answers5

8

enscript

pygmentize

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
  • OK never mind. PS here's a much more appropriate link for this question, given the languages he wants: http://pygments.org/docs/lexers/#lexers-for-web-related-languages-and-markup I found it from the page you linked to. – Mark Byers Feb 06 '10 at 15:34
  • How can I use these tools together? Or do I even need to?? – uloco Mar 30 '15 at 06:45
2
  • a2ps tool produces nice PostScript files for program listing printing.

  • Vim has :TOhtml command which produces HTML with current open file highlighted according to Vim syntax coloring. GVim has Syntax -> Convert to HTML menu for this.

  • If you use LaTeX, look at listings package (pdf documentation at CTAN). It's a very good solution for including your code in documentation/presentation.

All these tools support syntax of many programming (and non-programming) languages.

Community
  • 1
  • 1
Ilia K.
  • 4,822
  • 2
  • 22
  • 19
2

In emacs use ps-print-buffer-with-faces. There is also ps-print-region-with-faces for those occasions when you only want part of a file...

Use M-x <command> to invoke commands by name. Use C-h f <command> for help on a command and also to learn what (if any) keybinding it has.

dmckee --- ex-moderator kitten
  • 98,632
  • 24
  • 142
  • 234
1

Editplus prints with syntax highlighting intact

Paolo
  • 22,188
  • 6
  • 42
  • 49
0

The easiest way I've found after an hour search is this vscode extension:

identifier: "pdconsec.vscode-print":

enter image description here

You can either print it right away or save as pdf and print later(with highlighted syntax of course!)

e.saleh
  • 134
  • 2
  • 2
  • 8