Pagebreaks in Notepad++
-
Is there no way to insert a pagebreak in a Notepad++ document? I haven’t been able to find anything.
-
Hmmm, what exactly is a page break?
Back in the day, wasn’t it a “form feed” character that was used as a page break? Was it ASCII code decimal 12 or hex 0C ?
If so it seems like you could either use Notepad++'s Character Panel to insert one, or maybe the old hold-Alt-and-press-0-1-2-on-the-numeric-keypad trick…
-
I have a form that does not fill up two pages, but I want it to print as two pages. That being the case I want a pagebreak where the second page should start. I don’t want it to need to be a manual signal, but built into the document itself. I just tried the “Alt-0-1-2” and it gave me a FF in reverse print on the page, but did not supply the necessary LF-FF that would be needed,
-
I don’t want it to need to be a manual signal, but built into the document itself.
What does that mean? Just a hint, npp is not a WORD replacement and therefore is the wrong
tool if you expect it to be.@Alan-Kilborn mentioned a second option, Notepad++'s Character Panel, did you try this to put in the necessary control chars. If this work we can see if a script,
which calculates the height of each line can be developed to do this automatically. -
I tried the Character panel (Code 12), but that, aside from inserting the FF code into the document, did not actually place a form feed.
-
You did also save it, didn’t you?
And how exactly did you print? From within npp or some other app? -
@Charles-W-Billow said:
did not actually place a form feed
Well, it isn’t going to look like a special thing like it might in, say, Word. So if you are expecting that…don’t.
-
Apologies, I am beginning to lose track here, so, in summary:
I have a document that I want on multiple pages, and I want to control where each page ends. So, I want to be able to place a page break or form feed at desired positions.
I put a form feed via the Character panel (I believe that is ASCII Alt-012), which did in fact put a “FF” (sans quotes) on the page in reverse color (white letters on black) but when printed, it did not send a page-end or form feed instruction to the printer, but just kept on printing on the same page.
I don’t need to “see” the command in the document, but I do need it to work. It’s hard to believe that a program as adept as NP++, one that is used by many code writers, lacks this capability.
So there is no way to put a page -end / formfeed / page break command in a np++ document?
-
@Charles-W-Billow said:
it did not send a page-end or form feed instruction to the printer, but just kept on printing on the same page
It seems to me like that should have worked…
no way to put a page -end / formfeed / page break command in a np++ document?
It is probably premature to declare this; let’s see if we get some other responses.
-
@Alan-Kilborn said:
let’s see if we get some other responses.
Well, I’ve got a convoluted workaround.
First, a history lesson. In the old days (MS-DOS), printers were mostly looking for a raw stream of ASCII text, which they would interpret as either text or control characters – some of the control characters would move forward to the next line (CR, LF, or some combination); some would interpret FF as a form-feed, and move to the next page. Fast forward to Windows: people wanted fonts, people wanted graphics, people wanted those to print. Using fancy Windows printer drivers, applications like word processors and graphics programs would translate the fonty texts and graphical images into command the printer driver would understand, then the printer driver would change those commands into sequences that the printer would interpret (the printer wouldn’t think of most of it as text any more, just graphics). When you print from Notepad++, it goes through whatever processing Notepad++ does (including stuff so it decides how much of the syntax highlighting to propagate to the print job), then dumps that to the printer driver, and the printer driver tells the printer what it wants. So Notepad++ isn’t sending raw text to the printer.
The good news is, many printers still come with the ability that if you dump raw text into their input, they will still behave as the old dot-matrix and print that raw text in their default font. I found a sequence that worked for me:
SETUP
- Note the name of your computer. If it’s
BillowPC
, note that. (I will use that for my example from now on) - Open up your printer properties, and go to the Sharing tab. Tell it to Share this Printer, and give it a name, like
BillowPrinter
. Apply and/or OK - Using Windows Explorer, verify you really shared your printer by going to
\\BillowPC\
, and making sure there’s a printer icon forBillowPrinter
.
PRINTING
Go to the Run > Run… menu, then enter
cmd /c "copy "$(FULL_CURRENT_PATH)" \\BillowPC\BillowPrinter"
, and click Run to print it raw.AUTOMATING
Assuming that works for you, you can turn it into a shortcut:
- Run > Run… should still list that command
- Save…
- Enter a name (like
Print This File Raw
). Enter a keyboard shortcut. - OK to leave the save-dialog.
- Run to print the file again and exit the dialog, or Cancel to leave the the Run>Run dialog (somewhat counter-intuitive, but since you’ve already saved, it’s just cancelling the running of the
Print this file raw
)
The Run menu should list
Print This File Raw
at the end of the list of commands, and either selecting that or using the shortcut you assign will dump the bytes directly to the printer.Exit Notepad++ and restart (this will make sure you save your changes to the config file.)
Final Notes
If you’re asking yourself, “why is it so difficult”, please remember: Notepad++ is not a word processing or page layout software: it is a text editor. If you want a full-featured word processor, use one (LibreOffice is free and open source)
- Note the name of your computer. If it’s
-
I’m surprised in your long explanation you didn’t specifically mention the “form feed” capability. I presume that the fact that the method of printing you describes “goes around” Notepad++ printing, that the method describes will do the desired form feed operation if a FF character is embedded in the document.
Edit: concession: brief reference: “…some would interpret FF as a form-feed,…”
-
Guys, I appreciate the responses, but none seems to really answer my question/need.
@Peter Jones: While that workaround may sort of provide a solution, it’s too bad that it needs those gyrations.
I for years used Textpad (textpad.com). It has it’s own set of foibles, which led me to Notepad++.
At the same time however, it can and does to two things easily that for whatever reason the developers of NP++ have chosen not to include.
One of Print Preview (File / Print preview), a handy asset when one wants to have coding paginated a specific way.
The other is the Page Break we speak of here ( Edit / Insert / Page Break).
While Textpad is not free, as is Notepad++, it is relatively inexpensive at $16.50.
In most ways I prefer Notepad++, one of which, obviously is cost. I don’t understand why though, adding these two capabilities should be out of reach, since the developers of NP++ obviously are quite adept.
Why would I not just use Textpad one might ask, especially since I already own it? Little things I came across over the years that I seemed to find more comfortably resolved in NP++.
Anyway…
-
No offense, but why are we always think that a functionality available in one product must be also available in another? I mean, it does not make sense to have different products if those have the same functionality only.
From my understanding I would argue that printing seems not to be something the core dev(s) really care about and that is fine. If they don’t see any obvious benefit why should they bother spending their time implementing it, which takes us to the next point. Npp is open source, so everyone wanting this functionality and are capable of doing such an implementation can contribute to the project.
As said, no offense just my two cents. -
@Ekopalypse said:
From my understanding I would argue that printing seems not to be something the core dev(s) really care about and that is fine.
I second this, both in sentiment and agreement that printing is not important enough to care about. If one is going to create things that are printable with a lot of options use a word processor. Or pull your Notepad++ document into a word processor for final printing.
Looking at the OP’s posting history, however, it seems he is very obsessed with printing from Notepad++. :)
-
@Charles-W-Billow said:
While that workaround may sort of provide a solution, it’s too bad that it needs those gyrations.
Notepad++ is a thing where workarounds excel! Embrace them. I didn’t try Peter’s suggested workaround, because TBH I think anything beyond what you get with a basic print in Notepad++ is silly, but it is probably a good solution that just requires a one-time set up.
-
Did some quick research in the code.
As far as I can tell the module that actually prints text and decides about pages is Scintilla and not Notepad++.
So @Charles-W-Billow, feel free to go to Scintilla forum and ask them to respect form feeds within the printing logic (EditView::FormatRange). Specifically since printing seems to be at line resolution you would need to ask them that whenever a line contains form feed char and only form feed char Scintilla will end the current page.Generally my expectation would be that surveying 100 random Notepad++ users will show that 98 of them did not use Notepad++ ‘print’ feature in the last 6 month. But I may be surprised. If printing is a major part of your work choose the easy tool for that. If you mainly edit and rarely print then it should be completely acceptable to use 2 different tools.
-
surveying 100 random Notepad++ users
I have never used N++ to print.
-
@Charles-W-Billow said:
@Peter Jones: While that workaround may sort of provide a solution, it’s too bad that it needs those gyrations.
And, to quote myself:
If you’re asking yourself, “why is it so difficult”, please remember: Notepad++ is not a word processing or page layout software: it is a text editor. If you want a full-featured word processor, use one (LibreOffice is free and open source)
concession: brief reference: “…some would interpret FF as a form-feed,…”
Sorry, that was as much as I could give; while my printer yesterday did interpret the FF character as a form feed, I cannot guarantee that @Charles-W-Billow’s would. I guess I should have said the FF did work on mine, without making guarantees about behavior of other printers.
-
OK guys. Thanks.