@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
33fe7d55-14fc-41e1-bfb3-d121f83b1563-image.png
… So it’s showing them still connected.
(Here’s NPP screenshot before I printed to PDF:
ee7458bc-e218-417f-8fcd-5235c2f764ce-image.png
… 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.