Sign in to follow this  
MajinMusashi

Printing colored C++ source code

Recommended Posts

Seems a strange and not appropriate question, but... Right now I figured out that I CAN'T print colored C++ source code on Visual C++ 6. During a Google session, I've found only a non-free tool that could solve my problem... Do you know how to do it, either using Visual C++ or another IDE? Thanks! PS.: Stupid question? Maybe. PS.: Sorry, not an English native.

Share this post


Link to post
Share on other sites
I realize it's a bit lame, but it's how I did it for my classes.

I copied all the text (Ctrl-A in MSVC), and pasted into MS Word (works in OpenOffice too). It pastes w/ colour codes intact.

I only printed in B&W though, but considering it's colour in the Word document, it SHOULD print in colour too. I did it this way so I could modify the font size so I don't have 500 pages of code for a small app in C++...

Hopefully you can tell us (me?) whether this trick works or not.

[edit]
Judging from the reply below, it does work in 2002 (VC6). I used .NET, so it shouldn't be any different.

Share this post


Link to post
Share on other sites
This works in MSVS 2002, don't know about other versions: You can just select the code you wish to print, copy it to Wordpad/Word/[your word processor], and it will keep the formatting (ie, font, size, and colour) with it. You can then print it out from there.

Failing that, if it's only a small amount of code, you could go to a paste site (ie, http://www.rafb.net/paste/, paste your code there, and print it out in colour from your browser.

Also, Whole Tomato Software's Visual Assist allows you to print from MSVS in colour. Get the free trial version perhaps.

Hope this helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by sordid
I realize it's a bit lame, but it's how I did it for my classes.
I copied all the text (Ctrl-A in MSVC), and pasted into MS Word (works in OpenOffice too). It pastes w/ colour codes intact.
...
Hopefully you can tell us (me?) whether this trick works or not.

No, if didn't :) Already tried that trick (MS Visual C++ 6 -> MS Word 2003)

Quote:
Judging from the reply below, it does work in 2002 (VC6). I used .NET, so it shouldn't be any different.

Sorry, Visual C++ 6 was shipped before 2002 (around 98).

Share this post


Link to post
Share on other sites
Quote:
Original post by mattd
Failing that, if it's only a small amount of code, you could go to a paste site (ie, http://www.rafb.net/paste/, paste your code there, and print it out in colour from your browser.

No, it's a huge amount of code :) Because that I don't want to spend my whole day frying my eyes reading code directly from my CRT monitor.

Quote:
Also, Whole Tomato Software's Visual Assist allows you to print from MSVS in colour. Get the free trial version perhaps.

Hehehehe, that is the "non-free tool that could solve my problem...". Thanks anyway!

PS.: Well, now I'm beginning to believe I'm not that stupid, but some IDE developers are ;)

Share this post


Link to post
Share on other sites
Well, it's an old IDE :P Probably didn't see a need for context-exact copying.

I just remembered that my buddy was using TextPad for his coding, and always came to class with colour printed source code from it.. TextPad does support C++'s keywords and such. (http://www.textpad.com/)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this