Issue printing long lines



  • Hello

    I got some issues printing files with long lines.

    Take for example: https://code.jquery.com/jquery-3.4.0.min.js

    Tanking the text there, I see it correctly (88066 columns) however if I print it, it gets cut at 51521.

    Can anyone reproduce it?

    Notepad++ 7.7.1 64 bit





  • Thanks for trying but I am afraid I provided the link just as an example of a source with very long lines, I don’t need to convert or print it. And that would be a chrome printing not a notepad++ one, so it does not really apply to my issue.

    My issue is the truncated lines when printing with notepad++, be it to a PDF, or any other hardware or software printer.

    So if you open https://code.jquery.com/jquery-3.4.0.min.js in a browser and copy the text to a new notepad++ window and try to print it with notepad++ for example using “Microsoft XPS Document Writer” the output gets truncated.

    Hope that clarifies it.



  • @MayTheUniverseCollapse said:

    Can anyone reproduce it?

    I can get similar results using the “Microsoft Print to PDF” printer, even using a different file (I dumped 10,000 instances of “123456789x” into a single line, and tried printing).

    What I get is that after 2 pages of text from a single line, it skips some of the lines (or backs up; with my pattern, I cannot distinguish), and it stops printing after 5 pages. If I change the Notepad++ printer margins, it still skips some after 2 pages, but it’s at a different place in the sequence, and it’s still limited to 5 pages, even though it’s a different number of characters.

    Apparently, my new computer doesn’t have my PDFCreator printer driver installed… I will have to find time to install that, and see whether it’s just Microsoft PDF bug, or something truly independent of printer. Also, I will have to update my pattern so that I can see exactly how much data is lost under different circumstances.



  • @MayTheUniverseCollapse said:

    Hope that clarifies it.

    It was clear in the beginning…to most if not all.

    Irrelevant question but I’ll ask anyway: Why is printing so many columns even useful?



  • @Alan-Kilborn said:

    Why is printing so many columns even useful?

    Why is printing useful at all anymore? ;-)

    I can imagine you might be given someones .js code (as linked above), or one of those “source-code-obfuscated” HTML pages where they do everything on one line to try to make it hard for the incompetent people to read their oh-so-special code to make sure it doesn’t get copied – and maybe if you’re given this code, you might want to print it to paper, or to a PDF, or… Well, not the best example.

    Or maybe you’re given the first million digits of pi, and wanted to print it out to brown paper for a video, you might have a line that long. Or if you want to print out the then-longest-known-prime.



  • Back to the topic at hand:

    @PeterJones said:

    I will have to find time to install that, and see whether it’s just Microsoft PDF bug, or something truly independent of printer.

    Okay, I started with the following command to generate my file:

    cmd /s/c "perl -e "for('A'..'ZZ'){$x = '123456789_' x 8; substr($x, 0, 1+length($_)) = $_.':'; print qq($x);}" > %TEMP%\longline.txt"
    

    Which makes a 56,160 character file, all on a single line; I then set up my Notepad++ v7.7.1-64bit print margins such that the “Microsoft Print to PDF” printer would print 80 characters of my text per line (*1)… thus giving 702 lines. It printed A-BF on the first page, BG-DL on the second (so far so good), then (here’s where it goes wrong) FS-HX, then (skip some more) OQ-QV, and no more. (So only 4 pages this time, unlike the earlier experiment, which had 5 pages.)

    After installing PDF Creator v3.5.1, using same print margins, I got the same results. That does appear to be an issue in how Notepad++ handles it.

    I tried a few other versions (v7.6.3-64bit, 7.0.0-64bit), and they showed similar behavior: about 2 pages of characters on a single line, and it will start skipping big chunks, and not print the whole file.

    Back in 7.7.1, I took the same longline.txt created above, and added newlines (find=_\K(?=[A-Z]), repl=\r\n, REPLACE ALL), and then it printed all 702 lines as expected.

    (*1: for me, it was 10mm margins top, left, bot, and 9mm margins on the right; I had a single line of header and single line of footer on each page as well.)

    I was about to open a new issue when it suggested #3316, which linked to a post from the same time. I’ve bumped that issue, hoping that maybe it will gain some traction.

    ISSUE CONFIRMED



  • @MayTheUniverseCollapse ,

    If you are open to suggestions for workarounds: just add newline characters manually. Either

    1. find reasonable locations and add linebreaks: in javascript code, it might be after sections that have at least N characters followed by one-or-more closing braces: for example, for at least 64 characters followed by at least one end-brace would be FIND = ^.{64,}?\}+\K, REPLACE = \r\n, MODE=Regular Expression, REPLACE ALL.
    2. just do it every N characters, like the paginator does: FIND = ^.{80}\K, REPLACE = \r\n, MODE = regular expression, REPLACE ALL

    You can then undo after the printing is done if you need to keep the actual file without line breaks.



  • Thanks for confirming the issue.

    Sadly I can’t manipulate the texts that I need to be printed, but at least now I know what to expect.



  • @MayTheUniverseCollapse said:

    Sadly I can’t manipulate the texts that I need to be printed

    I don’t understand that statement. If all you’re doing is trying to print, and you don’t save the changes, all you are doing is doing the printer-formatting manually rather than relying on the linebreaks that Notepad++ inserts – either way, you are adding line breaks. Printing a long line across multiple lines is the same level of manipulation as putting in line breaks, printing, then undoing.

    If that doesn’t convince you (or whoever has given you this rule), then one or both of you does not understand what the printing process is doing. I wish you luck.



  • @MayTheUniverseCollapse said:

    Thanks for confirming the issue.

    Sadly I can’t manipulate the texts that I need to be printed, but at least now I know what to expect.

    a photo editor can fix your issue by rotate the text



  • @gurikbal-singh said:

    a photo editor can fix your issue by rotate the text

    I know you think you’re being helpful, but that in no way helps the OP fix or get around the problem of the print engine in Notepad++ not properly handling long lines of over about 10,000 characters.



  • @PeterJones @MayTheUniverseCollapse
    @dinkumoil said:

    Included features:

    • Set magnification for printing.

    is this plugin fix this issue


Log in to reply