How do I convert a Notepad++ texst file to a PDF file with the vertical spacing bvetween the lines staying the same?
-
I’m using Notepad++ to write a book. The book uses box drawing characters, which require the vertical spacing between lines to be very small. All of this needs to be exported in PDF format, but when I open the resulting PDF file, the vertical spacing is very high. Is there any way to fix this, either in Notepad++ or in the finished file?
-
@Maxim-Rodin
Feels to me like this is something that could be done with LaTeX. I’m not an expert or anything, but I know for a fact that math textbooks with all sorts of weird formulas and whatnot are written in LaTeX.In any case, the Notepad++ community forum is not really the place to ask for help on conversion of some arbitrary text document to a PDF, since Notepad++ has no built-in faculties for such a conversion. If you’re trying to “Print to PDF”, that’s a separate program that Notepad++ is interfacing with, and you’d want to look at documentation on how to print to PDF on Windows.
-
@Maxim-Rodin said in How do I convert a Notepad++ texst file to a PDF file with the vertical spacing bvetween the lines staying the same?:
The book uses box drawing characters, which require the vertical spacing between lines to be very small. All of this needs to be exported in PDF format, but when I open the resulting PDF file, the vertical spacing is very high. Is there any way to fix this, either in Notepad++ or in the finished file?
The problem might be the font you are using. When I use Fira Code as my font, print some box-drawing to PDF, and then open it in my free SumatraPDF viewer, the spacing looks reasonable (the boxes all connect) – the following is a screenshot from my PDF viewer
… So it’s showing them still connected.(Here’s NPP screenshot before I printed to PDF:
… it shows connected there, too)Also, if that’s not working for you, if you take your text file in Notepad++ and use Language > M > MS-DOS Style (which is the lexer that’s useful for the old ASCII art
.nfo
-style files… though.nfo
doesn’t seem to be in my default extension list anymore, which surprised me), Notepad++ actually changes the line spacing to make the lines closer together. So if changing fonts doesn’t work for you, try printing when in the Language = MS-DOS Style.Finally, the Settings > Preferences > MISC has some “DirectWrite” or “Rendering mode” settings (depending on which version of Notepad++ you are using) – you can try the various options available to you, as that influences how Notepad++ and the OS interface when dealing with fonts, so that can influence it. You may need to exit and restart Notepad++ for the DirectWrite setting change to take effect.
For example, in my tests with Fira Code font, if I had Language = “MS-DOS Style” but “Rendering Mode” set to “Direct Write (default)”, I would see gaps, even though in Language = “None (normal text)”, I wouldn’t see gaps. If I change to “Rendering Mode” = “GDI (most compatible)” (or DirectWrite=off in the old nomenclature) and restart and look at the box drawing in “MS-DOS Style”, it goes back to being connected. But my experience may be different than yours, because as I said, when I use FiraCode in my normal setup, the box drawing characters are properly connected.
In general, Notepad++ tries to print essentially what you see (in terms of font size, line spacing, etc), so if you see the box drawing connected when looking at it on-screen in Notepad++, it should print to PDF (or physical printer) that way, too. If not, it might be your printer driver, or you might need to change your font and/or DirectWrite settings.