Fitting More Code On Printed Page In Notepad++

11,543

Solution 1

The following works for me. Go to Settings > Style Configurator. Set the font size to something slightly smaller than the current setting. In my case it was 11 pt, so I set it to 10. Make sure you tick "Enable global font size". The default is "blank" (at the top of the list), which seems to be about 10 pt.

That will change the font size of the whole document to the new size, and it will print in that size. A change from 10 to 9 pt should fit your document on 1 page.

Another thing you can try is to remove headers and/or footers, by removing the current entries for them in Settings > Preferences > Print. Before you do that, you may want to write down what they are...

Solution 2

First, answering your question about decreasing the font size in Notepad++

Go to Plugins -> NppExecute -> Execute (if you don't see this option, see below how to install it). Type the following:

NPP_CONSOLE 0
 SCI_SENDMSG 2146 -2

-2 indicates that the original scale is decreased by 2 levels. I personally like -4 so lengthy files fit in fewer pages.

If you want, you can save the script by clicking Save... and type a name for the script. Click OK. Now, print as you normally would (e.g., File -> Print).

If you want to make this a permanent change, go to Plugins -> NppExec -> Advanced Options...*. NppExec Advanced Options window will open. Under Advanced Options -> Execute this script when Notepad++ starts:, select your saved script, click OK.

If plugin NppExec is not installed

Go to Plugins -> Plugin Manager -> Show Plugin Manager. Select NppExec and click Install. Then follow the instruction above.

From: https://www.thefreewindows.com/19675/configure-notepad-smaller-print-font/

Second, if you want to use Word

There is an easy way to add line numbers: Layout (tab) -> Line Numbers (Page Setup group). Select the option you prefer.

From: https://support.office.com/en-us/article/Add-or-remove-line-numbers-b67cd35e-422c-42eb-adc9-256ca9802e22

Share:
11,543

Related videos on Youtube

azoundria
Author by

azoundria

Updated on September 18, 2022

Comments

  • azoundria
    azoundria over 1 year

    At the moment, I'm trying to print a snippet of code that is about 1.03 pages long. The last several lines start on the next page. As a result, I waste an entire page, and it's also much harder to follow because it's on two pages.

    After much effort, I managed to locate the ability to change the font size, however when I decrease the font size it actually doesn't seem to fix the problem. I decreased the font size from 10pt to 8pt, and there are still the exact same number of lines on the first page. The characters are indeed smaller, however it seems that the line height is the exact same. When I put the two pages side by side, the lines line up exactly.

    The reason I'm printing with Notepad ++ directly is to preserve the filename and line numbers. So if there isn't a way to get Notepad ++ to do this, is there an online utility of some kind which is directly for this purpose? To be clear, I need to have only the small selection of the code printed, not the entire file, or I need to start the line numbers at a value higher than 1. All of the utilities I found so far typically did not give me output I could directly print, and I have yet to find one that has a line number offset or the ability to put the filename in the header.

    Limited solutions:

    • Printing from Notepad ++. Fails to fit the code on the page.
    • Copying into Microsoft Word and adding line numbers manually. This is quite labour intensive, and I'd like a solution that works very quickly to print code. Also, no syntax highlighting unless I do it manually.
    • Copying into Microsoft Excel. This removes the need to manually increment the line numbers, but formatting is quite limited and there's once again no syntax highlighting unless I do it manually.
    • pretty-print.net. Does not print C++ syntax highlighting. No way to change line number. Lots of headers and footers in printed output.
    • hilite.me. Prints with a massive header. No way to adjust line numbers.
    • hilite.me and copy into HTML and then print from browser. Requires manually adjusting all the line numbers.
    • prettyprinter.de. Messes up the formatting and does not add line numbers.
    • Making my own utility. While I could do this fairly quickly, the syntax highlighting seems like it would be much more complex than any other part.

    The code is C++ code. I'm hoping for a solution that isn't limited to C++ though. If I have to, I'll make my own utility and forego syntax highlighting, but this seems like something someone would surely have done already.

    • hdhondt
      hdhondt over 7 years
      How about reducing the font size? Go to Settings > Preferences > General
    • azoundria
      azoundria over 7 years
      That was the first thing I did, and as I explained, it printed in the same number of pages. Somehow the letters were smaller but they used the same space. The line height was the same.
  • azoundria
    azoundria over 7 years
    Upon trying again, it works. I still physically have the two printouts from the other day when I had this problem. The font size did change between them, but the line height definitely did not. I can hold the first page of both printouts side by side and the lines line up exactly, while the PDFs I produced today definitely don't have lines lining up at any font sizes from 7 to 11 pt with the exact same file. I guess my problem is solved, but I still can't think what could possibly be different other than that I restarted the computer and opened Notepad ++ again and a bunch of time has passed.