How do you print in Visual Studio Code? RRS feed

All replies

  • Hi,

    Console.WriteLine("Text to print");

    Thanks, Please mark this answer if helpful.

    • Edited by Shafiq Abbas Saturday, February 13, 2016 12:10 PM
    Saturday, February 13, 2016 12:10 PM
  • The question is simple.  How can you print from within Visual Studio Code?

    Do you mean print to screen or print to a printer ?


    Saturday, February 13, 2016 7:51 PM
  • I would like to know how to print the program I'm editing with VS Code to a printer
    Friday, June 17, 2016 6:49 PM
  • Apparently microsoft took a page from Sublime Text and decided that actually printing something out is a low priority, outdated use for a TEXT EDITOR.

    In short, doesn't look like you can print to a printer at all with it.  But, as some "brilliant" person said on a similar topic for Sublime, just copy it into an editor that can print and print from that!

    Friday, September 16, 2016 7:49 PM
  • Simple answer: Visual Studio Code does not print :(

    • Edited by Hanko Panko Friday, December 9, 2016 11:09 PM
    • Proposed as answer by AppFzx Thursday, January 17, 2019 2:30 PM
    Friday, December 9, 2016 11:09 PM
  • In this case I recommend use Notepad++. I have the portable version only to print my codes.
    Friday, February 24, 2017 10:14 PM
  • The question is simple.  How can you print from within Visual Studio Code?

    If you use google drive, you can right click on the file in explorer and select Google Drive->View on the web and then print it.


    Tuesday, August 15, 2017 7:16 PM
  • Agreed, this is completely insane

    Were the M$ devs smoking something or perhaps just had a common sense bypass?

    Saved me the time searching anyway!

    Sunday, October 22, 2017 2:24 PM
  • I need to do this as well. Copy paste won't work as I want to keep the same format, font, colours etc. 
    Monday, October 30, 2017 5:08 PM
  • Agreed, this is completely insane

    Were the M$ devs smoking something or perhaps just had a common sense bypass?

    I'm sure the money-hungry M$ corporation would happily refund the money you spent on this free product.
    Monday, October 30, 2017 6:28 PM
  • So are you suggesting that since the program is free we should all just hold hands and drink the kool-aid when it lacks features that even the most basic text editor on the planet should include?

    I like VS Code. A lot. But the lack of a printing functionality is just bone headed and dumb. Since they seem to be following in the footsteps of Sublime and Atom on this I am going to assume that some hipster "modern" web developer made the assumption that since most people use electronic devices no one would ever actually want a hard copy. I expect this from the Sublime and Atom crowd. I also expect the guys at Microsoft to be a little more old school and exercise some common sense.

    For those reading this that are fortunate enough to use VS Code on Linux, most Linux distros include the 'lpr' utility by default, which prints to the default system printer. Typical usage is ```lpr <filename>``` or ```lpr filename -o page-ranges=2-6>```

    This should work fine from the embedded terminal in VS Code. Might even work on one of those cutesy coffee shop laptops. Not sure if the Jobsians stripped lpr out of OSX.

    Wednesday, November 8, 2017 8:11 PM
  • It's insane, but... In Windows, select all text (CTRL+A) and Copy&paste into Word, which retains the formatting.  "Landscape Orientation" and "Narrow Margins" looks best.
    Wednesday, January 3, 2018 7:20 PM
  • I use an extension.

    Its called "PrintCode"

    When you have installed it you just have to type "PrintCode" in the command lane (F1) and you will be able to print it out.

    • Proposed as answer by Dan Ignat Tuesday, March 13, 2018 9:19 AM
    Saturday, January 6, 2018 3:33 PM
  • I agree. Nearly all programs have a File -> Print option. I don't understand why I just simply can't print a file in VS Code (you can in Visual Studio 2017).

    Microsoft, you missed the mark here!

    • Edited by R. Mayerik Tuesday, January 23, 2018 1:45 PM
    Tuesday, January 23, 2018 1:43 PM
  • That prints the source. If you need to print the preview (e.g., for a Markdown document) what can you use?
    Wednesday, April 4, 2018 5:08 PM
  • If you have a different default browser from Chrome, you need to do this in your User Settings to set the printcode.browerPath: 
    "printcode.browserPath": "/Program Files (x86)/Google/Chrome/Application/chrome.exe"

    Dan Randolph - My Code Samples List

    Wednesday, April 11, 2018 4:30 PM
  • Did not work for me. The "print" function from PrintCode in Vcode merely opened an empty IE tab.

    How the heck do you do that.

    Anyway, opened in NP++ and printed perfectly. ---- bizarre font here change after cut/pasting from above. Could it be the PrintCode boys getting revenge?


    Wednesday, April 18, 2018 2:41 AM
  • Just plain dumb that a print feature is not in Visual Studio Code.
    Wednesday, April 18, 2018 5:24 PM
  • An extension makes sense to me so that those who don't need this functionality don't have to carry the memory footprint with them everywhere ... lean and mean coding editing machine!
    Saturday, May 5, 2018 8:27 PM
  • I have install on my computer IDLE 3.7. If you open with it you have a print windows option under the File tab or short cut CTRL+P.
    Saturday, September 15, 2018 3:33 PM
  • clone your file in a GitHub repository

    open the file in Github and print (right-click)

    Sunday, October 14, 2018 6:10 PM
  • Simple answer - Microsoft have decided not to include this functionality.  Strangely enough, the first thing I wanted to do after installing VSC was print out a few pages of code so that I could read them and spot where my errors were (I can't always spot them on screen, don't ask me why).  So, next time I switch the machine on, the first thing I will be doing is uninstalling VSC...
    Wednesday, November 14, 2018 12:03 PM
  • The PrintCode extension mentioned in this thread works for me.
    It works best of your default browser is Chome I think.

    It is not perfect, for example, it can only print in portrait mode.
    But it works well for me.

    Friday, November 16, 2018 11:43 AM
  • File Print would be GREAT!

    However, change File > Preferences > Color Theme > Light

    Copy all, Paste into WORD and print to your printer of choice.

    Tuesday, January 8, 2019 6:20 PM
  • I did get the same issue though. In my case, the default browser is Chrome on Mac. After seeing empty page, I hit the reload button on the browser. It popped up printer window in portrait mode.
    Wednesday, January 16, 2019 5:22 PM
  • Wow what a good idea! Copy somebody elses dumb idea.  Reminds me of a movie line "Have IQ's dropped sharply..."  Or how about MS has the "dumbest smart people"... paraphrase

    OK I like Sci Fi.  But then again i like to PRINT

    Wednesday, February 6, 2019 12:17 PM
  • I got fed up with the fact that VS Code doesn't support printing and wrote my own printing extension.


    Tuesday, April 2, 2019 3:30 AM
  • Microsoft would say not only is it open source it explicitly supports extensions, and if it actually matters and you aren't just bitching then there's nothing stopping you from addressing the problem yourself.

    And they'd be right, so I did, and as a result printing does all the things I care about, like line numbers and syntax colouring and the ability to double space for pencil annotation in a code review.

    Here it is. Given the way it works, it should be cross platform but I use Windows so I can't swear to that. Try it out and let me know whether there are any issues on Linux.


    • Edited by Peter Wone Tuesday, April 2, 2019 3:37 AM
    Tuesday, April 2, 2019 3:36 AM
  • Funny you should say this, I didn't like PrintCode so I wrote my own, and it does indeed have an option to render Markdown when printing it. I've linked to it further up in replies to earlier comments.


    • Edited by Peter Wone Tuesday, April 2, 2019 3:41 AM spurious word
    Tuesday, April 2, 2019 3:41 AM
  • That's caused by the embedded webserver taking too long to spin up the first time. I had a devil of a time solving this in my own printing extension. Basically you have to prime the pump by having the extension request a print job from itself and discard the result during initialisation.


    Tuesday, April 2, 2019 3:48 AM
  • Yeaaaaaaaah ... that's not an excuse for leaving out obvious features. Quality sarcasm though.
    Wednesday, May 1, 2019 2:30 PM
  • There are two ways to print from within visual studio code if you are using

    1. Create a text file and save it using the save dialog. Have notepad as part of the process so you can then print from notepad.

    2. If you want rich text you must create a graphics document and print the graphics document. It is very complicated but I can provide the code if you wish for both methods. This is great for table alignment.

    2. I'm trying to print a series of forms but having trouble.

    Wednesday, June 12, 2019 11:25 PM
  • Pete, you are great! This worked on Mac Catalina for me. Thanks so much.
    Wednesday, March 18, 2020 3:32 PM