locked
Printing source code with syntax coloring

    Question

  • I apologize in advanced if this has been covered somewhere already, but I can't seem to find it if it is.

    With that said, I'm trying to figure out how to print out source code with the syntax coloring. In Visual Studio 2008, when I would tell it to print a source document, I would get a page off the printer that looked exactly like what I had on the screen. (i.e. comments are green, reserved words are blue, text strings or characters are red, etc...) When I print something out of VS2010 everything is black and white save for the line numbers.

    I've gone through the fonts and colors settings in the options, and all the settings for the printer are set to the same thing that the text editor is set to... yet I can't get color coded source to print.

    Is this common, or is it just me? If it's not just me, was this intentional or is it a bug?
    I don't know if it happens with any of the languages other than C++. I don't code in anything else.


    I'm running:
    Windows Vista Ultimate x64 SP2, Visual Studio 2010 Ultimate Beta 2 (though the problem was in Beta 1, too), and Visual Studio 2008 Professional, all with the latest updates.
    Saturday, October 24, 2009 8:08 PM

Answers

  • Hi everyone,

    Thanks again for your feedback about the absence of color printing from Visual Studio 2010.  I'm writing to let you know that although this isn’t built into VS 2010, we just released a free Color Printing extension today.  It should re-enable the ability to print code with syntax coloring, as you could in earlier versions of Visual Studio.
     
    More details about the extension and its functionality are available on the Visual Studio Blog at http://blogs.msdn.com/b/visualstudio/archive/2010/11/30/color-printing-extension-now-available.aspx.  You can also download the Color Printing extension directly from the Visual Studio Gallery at http://visualstudiogallery.msdn.microsoft.com/en-us/00ec88c2-1553-47d2-8170-3c5baa0c6e44?SRC=Home.
     
    Once again, thank you for your feedback.  In fact, this extension was created largely in response to reports like yours.  If you have questions or comments about color printing, feel free to post them here or in the comments section of the VS Blog post listed above.  If you find a specific bug in the extension, please file a new Connect bug so we can investigate in more detail.
     
    Thank you again,
     
    Brittany Behrens | Program Manager | Visual Studio Platform - Editor | The Visual Studio Blog | @VSEditor on Twitter 

    Tuesday, November 30, 2010 8:54 PM
    Moderator

All replies

  • Hi Sean,

    I have addins to Viisual Studio 2005, 2008 and 2010(awaiting VS 2010 release) that print the source code the way it should be printed. The printed output cane be exported to RTF and PDF. Try our website  http://www.starprinttools.com
     
    Regards,
    joginder Nahil
    www.starprinttools.com
    Sunday, January 24, 2010 1:29 PM
  • Hi Sean,

    Color printing is a feature we unfortunately had to cut from VS 2010 due to time constraints.  As Joginder mentions, there may be third-party solutions available for RTM, but you won't see an option for color printing in the product itself (for C++ and all other languages).  However, we will be reevaluating this feature for a potential VS 2010 service pack or future release, though I can't promise any specific timeframe.

    Brittany Behrens | Program Manager | Visual Studio Platform - Editor | The Visual Studio Blog
    Tuesday, February 02, 2010 10:38 PM
    Moderator
  • What a bummer! Not sure how much time was required not to pull functionality that worked great in VS 2008. Having to look for third-party solutions is unfortunate, to put it mildly.
    Jonathan Wood | SoftCircuits | Developer Blog
    Thursday, April 22, 2010 8:06 PM
  • Yes, a huge disappointment ... I encourage Microsoft to add color printing of source code into VS 2010 ASAP.

     

    Wednesday, May 05, 2010 12:40 PM
  • Wouldn't adding the feature to VS, drive them (Joginder and starprinttools.com) out of business?

    Come on....they make their living out of it.

     

    Is it fair, if the same was done to you...??

    Wednesday, May 05, 2010 5:15 PM
  • newborn07: First of all, previous versions of Visual Studio fully supported this and so nothing would've changed if Visual Studio 2010 did also.

    Second, I don't know what you consider fair. Innovation comes from making a "better mousetrap." Are you suggesting all innovation should be halted if it could negatively impact the status quo? That seem like odd thinking to me. Certainly, there would be no Visual Studio at all if that's how things were done. Fortunately, other people don't think like you and we have Visual Studio and lots of other cool and productive stuff too!


    Jonathan Wood | SoftCircuits | Developer Blog
    Wednesday, May 05, 2010 5:30 PM
  • Bummer dude - I miss my code in color, loved it in past versions..... Always bums me out when good features go away

    Please bring printing code in color back!

    Thanks, Stuart

    Sunday, May 09, 2010 9:32 PM
  • Hi Sean,

     

    I was a bit surprised to see this missing; however, I get it.  I have found I can cut and paste the code to my email and print that.

     

    I primarily print out snipits to review later when I am going off doing something else away from the desk.  Good to take to a meeting to make sure I cover needs etc.

     

    Not a huge deal.  But it would be nice.  And I assumed it was there.  I'm sure others will too.

     

    Have a great day,

     

    Roger

    • Proposed as answer by Roger Gray Thursday, May 13, 2010 10:01 PM
    Thursday, May 13, 2010 10:01 PM
  • Color printing was available in the first beta for vs2010 (at least for c++). This went away in the 2nd beta. After that install I got error messages relating to xml services but none of the dumps which could be taken meant anything to me. When the release product came out I uninstalled beta2 in hopes that a new install would fix the problem.  It didn't.

     

    I think MS definitely needs to add this feature back into the product.

    Wednesday, May 26, 2010 2:05 PM
  • I hate it missing as well.  I am a 'desk-checker' of my code.

    I will print out functions and look at them at a coffee shop occasionally to make sure i get it the way I want it BEFORE I start typing anything.  Not printing in color blows.

    I have used 3rd party components in the past and frankly, I like the built in stuff.  Let the 3rd party develpers build it for MS and ship it with the product.  Everyone wins - including the developer that likes colored printing.

    Wednesday, June 02, 2010 8:19 PM
  • Hi Sean

    As you can shut your left ear with the right hand so you can have a coloured copy of your listing:

    1. copy the part of the listing you need (Strg c on the german keybord )

    2. Open a WORD Document

    3. drop the copy into that document

    4. print it

    The print of Visual Studio 2010  in my examle has about 78 lines, the Word document prints about 56 lines on 1 page so I needed 2 pages.

    ciao Michael

     

    Thursday, June 03, 2010 3:41 PM
  • +1 for adding this feature back please, as old-school as it may sound, some of us still prefer source code on paper for code walkthroughs :)

     

    Wednesday, June 23, 2010 8:28 AM
  • No printing syntax colors?  Oh No!  Please put it back in.  I find syntax coloring a big help in proofreading code.  For well known reasons, I read text much better on paper than a screen so it's pretty important to me.  I really don't want to go back to VS2008 because of the 237MB framework each user has to install.  Printing syntax color is so important I may just have to do it.

    Will it help if I beg?

    Patrick

     

    Thursday, July 15, 2010 10:19 PM
  • @Digadigado - To clarify, VS 2010 definitely has syntax coloring.  What's missing is the ability to *physically print* a hard copy (i.e. on paper) of your code with syntax coloring, not the ability to display syntax coloring on the screen.

    I'll also reiterate that color printing is on our backlog for the next release of Visual Studio.  We know this is a pain point for those of you who like to print hard copies of your code and we'll be revisiting it for v.next.

    Thanks for your continued feedback,

    Brittany Behrens | Program Manager | Visual Studio Platform - Editor | The Visual Studio Blog

    Thursday, July 15, 2010 10:26 PM
    Moderator
  • Hi Brittany,

    Thanks for the quick response.  I'd already corrected my entry and our posts probably crossed paths electronically.  I'm glad to hear color printing will definitely be added. Your earlier response said only that you would reevaluate it.

    Thanks,

    Patrick

     

    Thursday, July 15, 2010 10:31 PM
  • No problem!  FYI, though, "in our backlog" and "revisiting" mean "likely", not "definitely" :-).  It's still too soon to 100% promise anything.

    I'm sorry to be so vague about this; Microsoft guidelines unfortunately limit what I can and can't say about future releases.

    - Brittany

    Thursday, July 15, 2010 10:48 PM
    Moderator
  • Is there an update on this?  Not being able to print in color is really becoming a problem.
    Tuesday, September 14, 2010 4:55 PM
  • It was solved for me by going to http://www.starprinttools.com/ and purchasing the VS2010 product.  At first I did not like it until I found a setting to have their component use the 'current VS colors'.  That made the printout pretty good and it has some great benefits that VS has never had such as an outline of the functions and class structure.  Be sure to set the printer properties to landscape in both the component and the printer dialog.  Otherwise, the results are not what expected.

    As for Microsoft's failure to get this feature into 2010, I say "shameful".  You could have left off the zoom feature in the dev environment and worked on the printing and users would have been happier.  I had to find some code to disable the mouse-wheel zoom feature because I was constantly changing it accidentally.  Any developer that uses shortcut keys will find the zoom feature to be a huge pain and will also want to disable it.  But, I digress...

    Tuesday, September 14, 2010 8:59 PM
  • I have to agree with EVERYBODY else on the thread. This is important for me too for pretty much the same reasons.

    Is there an update on adding this feature back into VC++? If not, can the DLL controlling this feature from the VC++ B1 be imported into the current one?  Else, can we have the source code to implement this ourselves? I'm sure there's a huge developer base that would have this implemented today.

    Incidentally I found a free opensource software that will open the source code (from many different software standards) and print it in color. That software is called Notepad++.

    http://notepad-plus-plus.org/

    Thank you.


    -I'll probably choke on these words later.
    Wednesday, September 15, 2010 2:59 PM
  • There is MSDN in the url, one would assume that MS (their India headquarters, anyway) would occasionally peek in and respond.  One would think that the users would be able to decide what makes for a good development environment, not a think-tank of non-developers.

     

    Wednesday, September 15, 2010 3:43 PM
  • Come on guys!!!!!!!!!!!! Let's take another giant leap backwards for developerkind.

    How about no mouse wheel scrolling code files in the Editor? That doesn't work either...

    Or... Silverlight 1,2,3,4 in the space of 2 years... Now, VS 2010 Whoopty Doo is under baked. This is beyond ridiculous.

    I'm done scratcing my head over Microsoft lunacy. Cancel my subscriptions and licenses...

    http://netbeans.org/downloads/

    http://www.amazon.com/gp/offer-listing/1890774421/ref=dp_olp_used?ie=UTF8&qid=1285872602&sr=8-1&condition=used

     

    Thursday, September 30, 2010 6:55 PM
  • This is disappointing to hear. While I do love much of the new functionality in VS2010, the fact that what many consider basic functionality is missing makes it difficult to recommend upgrading. We are not in the 90's anymore; as was pointed out in a previous post, even editors such as notepad++ have this basic functionality.

     

    Do you really want me to stand up in a meeting and argue for purchasing a $16,000 software package (http://www.microsoft.com/visualstudio/en-ca/products/2010-editions/ultimate) that requires our developers to cut and paste code to freeware in order to print for code reviews? Worse yet, you can't even tell me that this functionality will be implemented. If I had that I could at least make a plausible argument for this product.

     

    I can not recommend this upgrade until the basics are resolved.

    Tuesday, October 12, 2010 5:58 PM
  • Hi Sean,

          I have a temporary solution to this problem that I figured out because I have Visual C++ 2008 express and Visual C++ 2010 express.  I downloaded both of them off of the Microsoft website.  In order to do this you need Microsoft Visual 2008 edition and I see you already have it.    As you know the 2008 version does print out the source code in color but the new 2010 version does not. 

     

    This solution does create more work for the programmer but it temporarily solves the issue until Microsoft updates Visual C++ 2010 or releases another version with this capability.  The instructions are below.

    1. First create a new Win 32 console project in Visual C++ 2008 and minimize the window to the taskbar.

    2. Then copy the source code from your project in Visual C++ 2010.

    3. After this, go back to your console project in Visual C++ 2008 that you just created and create a new .cpp file for that project.

    4. Last, when the window opens up ready for you to type the source code, just paste the code that you copied from Visual C++ 2010 into the new .cpp file.  You still have  to compile and the run the code but, now you can print this code in color because you copied and pasted it from Visual C++ 2010 to Visual C++ 2008.

    I am going through the C++ primer plus book and I find that when the source code is in color it is much more readable so, I do this all the time.  Let me know if this helps or if you have anymore questions.  Thanks.

    David Glatzl

    • Proposed as answer by DGprogrammer Monday, November 22, 2010 11:16 AM
    Sunday, November 21, 2010 5:34 PM
  • Hi everyone,

    Thanks again for your feedback about the absence of color printing from Visual Studio 2010.  I'm writing to let you know that although this isn’t built into VS 2010, we just released a free Color Printing extension today.  It should re-enable the ability to print code with syntax coloring, as you could in earlier versions of Visual Studio.
     
    More details about the extension and its functionality are available on the Visual Studio Blog at http://blogs.msdn.com/b/visualstudio/archive/2010/11/30/color-printing-extension-now-available.aspx.  You can also download the Color Printing extension directly from the Visual Studio Gallery at http://visualstudiogallery.msdn.microsoft.com/en-us/00ec88c2-1553-47d2-8170-3c5baa0c6e44?SRC=Home.
     
    Once again, thank you for your feedback.  In fact, this extension was created largely in response to reports like yours.  If you have questions or comments about color printing, feel free to post them here or in the comments section of the VS Blog post listed above.  If you find a specific bug in the extension, please file a new Connect bug so we can investigate in more detail.
     
    Thank you again,
     
    Brittany Behrens | Program Manager | Visual Studio Platform - Editor | The Visual Studio Blog | @VSEditor on Twitter 

    Tuesday, November 30, 2010 8:54 PM
    Moderator