How to: Print Code in the Editor

The integrated development environment (IDE) provides many of the familiar print features available from your operating system, along with a few features specific to Visual Studio. For example, you can include line numbers or omit collapsed regions in print outs, as well as include the file name and page numbers.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.

The line numbers displayed in the Code Editor do not print by default. In addition, you can choose to print line numbers even if line numbers do not appear in the Code Editor.

To print line numbers

  1. On the File menu, click Print.

  2. In Print what, select Include line numbers.

  3. Click OK.

You can choose to only print the content currently viewable in the Code Editor, omitting collapsed regions.

To print the current view of a file

  1. On the File menu, click Print.

  2. In Print what, select Hide collapsed regions.

  3. Click OK.

You can choose to include a header on print outs that includes the full path and name for the file being printed, as well as page numbers.

To print file name, path, and page numbers

  1. On the File menu, click Page Setup.

  2. Select Page header.

  3. Click OK.

  4. On the File menu, click Print.

  5. Click OK.

You can choose to print text in a different font face and size than the font face and size that you use when editing in the Code Editor.

To print using a font that is different than the font in the Code Editor

  1. On the Tools menu, choose Options.

  2. Expand Environment, and then click Fonts and Colors.

  3. In Show settings for, select Printer.

  4. In Font, select a different font face for printing.

  5. In Size, select a different font size for printing.

  6. Click OK.

Color printing

In order to enable color printing in Visual Studio 2010, you must download and install the Color Printing extension from the Visual Studio Gallery. This extension can be installed in Visual Studio Pro, Premium, or Ultimate; it cannot be installed in Visual Studio Express. Note that this extension does not include the option on the print dialog to print line numbers. In order to print line numbers, you must enable the line number option in Tools -> Options.

The printed font and color may differ from those displayed in the editor, in particular when the Tools -> Options settings for Text Editor are not the same as those for Printing.

See Also

Concepts

Customizing the Editor

Other Resources

Editing Text, Code, and Markup