Is there a way to do a new Page Brake
-
Hi, is there a way to do a new Page Brake in Notepad++ ?
so at that point a New Page will be Printed.
Thank You. -
Hi, is there a way to do a new Page Brake in Notepad++ ?
so at that point a New Page will be Printed.
Thank You.So, the “positive” answer: to insert the ASCII 12 Form Feed (U+000C, which is the “page break” for old-fashioned printers), you can use the Edit > Character Panel, and double click on the
FF.Depending on your Settings > Preferences > Editing 2 > Non-Printing Characters settings, you may or may not be able to enter that character by other means – with “Prevent control character (C0 code) typing into document” checkmarked, you cannot use the windows
Alt+012to enter that character, whereas if it’s not checkmarked, you can: but the Character Panel overrides that setting, and will still enter that character into the document. To be able to see that the character is there, you need to have View > Show Symbol > Show Control Characters and Unicode EOL enabled – if it’s enabled, you’ll see aFFin a reverse-text box; if it’s not enabled, you won’t see anything, but you will be able to use arrow keys to move left or right across the invisible character, and you’ll see the status bar column number change even though the typing caret appears to be in the same place.But (and it’s a big but), the printing algorithm that Notepad++ uses sends the Scintilla replacement boxed-FF glyph to the printer, instead of sending the actual character. (Furthermore, I think that modern Windows printer drivers don’t interpret the ASCII 12 as a “new page”). You might be able to copy the text file directly to the printer from the command line (or from Notepad++'s Run > Run… dialog) using old MS-DOS style commands, like Run > Run >
COPY "$(FULL_CURRENT_PATH)" /B PRN(wherePRNcould bePRNorLPT1or\\ComputerName\PrinterShareName), and that might bypass some of the printer drivers and instead send the raw ASCII to the printer, which your printer might interpret as a control to move to the next page … but if you do, then you lose the rest of Notepad++'s rendering (which means it won’t follow your Notepad++ font settings or line-numbering or headers or syntax highlighting).So the short summary: you can insert the form feed character, but Notepad++'s print algorithm doesn’t treat that form-feed character as a page break, so to get that character to behave as you want it to, you’d probably have to print using MS-DOS-era print commands, hoping that modern Windows still allows such.
update: what I said here is essentially what I said in 2019 in this old discussion; that discussion concludes that the ability to handle form-feeds as page breaks would need to be implemented in the Scintilla library (which Notepad++ uses) before Notepad++ could offer it as a feature.
-
@PeterJones
Thank you,
For some reason it won’t work!
I do not know how Printers Work, unfortunately I am too old to learn anymore.Perhaps the Programmers could add a “New Page” Feature.
To Bypass the Manufactures Lacking.
In my search for a solution, I have come across many asking for the same thing,
They are trying to Break Sub’s & Functions into something Better Looking. -
Perhaps the Programmers could add a “New Page” Feature.
This feels like an excellent example of something that would be best implemented in a plugin. Given how many other things the core devs already have to juggle, I rather doubt users are best served by having those devs try to understand the mystical arcana of modern printer drivers.
Unfortunately I am definitely not the right person to create such a plugin, but maybe somebody else reading this could try and devise a plugin to make NPP play nicer with printers. Maybe such a plugin already exists; I haven’t done any research because I have no need for one.
I’ve always felt that if I needed something printed, I would be much better off converting it into something like a docx or a PDF and using a PDF viewer or Microsoft Word to try printing it out.
-
I rather doubt users are best served by having those devs try to understand the mystical arcana of modern printer drivers.
Turns out, in this instance, it’s really simpler than people made out – and you need 0 knowledge of printer drivers to implement it. I’ve got proof-of-concept code working already, and once I am able to get the Preferences option working, I will be submitting an issue and PR to implement this.
Explanation: What notepad++ does is loop through the document, and passes the start/end to the scintilla print formatter, then scintilla returns where in that range it stopped processing; the next loop through, the new “start” is the end of the previous range (fence posts are properly accounted for in the conversation). So for this, all I have to do is search if there’s a FF character between start and end, and if there is, temporarily change the end that it sends to Scintilla for asking for the next page. the real logic/implementation was about 12 lines of code in one already-existing function, and an hour or so of experiment/testing/debug. The more difficult part is the GUI/preferences, which I’ve never done before, and which require edits in a half dozen different pieces of source code that all must interact properly.
Side note: In more than a decade of people complaining here in the forum about the lack of page break, LITERALLY NO ONE ever bothered to make an issue of it – at least that I could find, by searching “form feed”, “formfeed”, or “page break” in the Issues tracker, open or closed issues.
-
I have an initial implementation available through the GitHub action build for now (https://github.com/pryrt/notepad-plus-plus/actions/runs/26252176986#artifacts – artifacts should be there in a few minutes from when I post)
- If you have
Text Of Line[FF][EOL]NextPagethen the[FF]will be the end of page1 andNextPagewill be the beginning of page2 - If you have
Something[EOL][FF]NextPage, then theSomethingwill be the end of page1 and[FF]NextPagewill be the beginning of page2 - I don’t recommend it, but
Text of[FF] Line[EOL]SomethingElsewill putText of[FF] Lineon page1 andSomethingElseon page2 (this is due to the fact that scintilla will always go to the end of the line, even if it goes beyond the “end position” that you passed it, and it doesn’t consider FF an EndOfLine character for this purpose. That would have to be fixed in Scintilla, as there’s nothing I can do about it from the N++ end.) - View > Show Symbol: if Show Control Characters & Unicode EOL is on, then Notepad++'s display and the printed file will include the FF box-glyph. If it’s off, then neither N++ nor the printed file will show the FF box-glyph.
The option defaults to OFF. To turn it on, use Settings > Preferences > Print > Print formfeed as page break.
I hope that you (and other interested parties) would test it over the next few days. I will likely create the issue right after posting this message (update: Issue #18059), but will wait until this weekend to submit the PR, in case there are obvious things that would improve it before I submit it to the codebase.
- If you have
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login