pdewacht / brlaser

Brother laser printer driver
GNU General Public License v2.0
608 stars 115 forks source link

HL-L2320D can't print this pdf #52

Closed 0xAl3xH closed 4 years ago

0xAl3xH commented 5 years ago

I stumbled upon a page that I was not able to print today: cant_print.pdf using v5. Can someone see if they can print it on other printers or versions and what might be the issue? Thanks!

Edit: I have found a workaround for my problem

0xAl3xH commented 5 years ago

Bump on this. Anyone able to replicate this? Also, any tips on looking at useful logs to debug?

0xAl3xH commented 5 years ago

Tried v6 and still couldn't print so played around with source a bit. Reducing lines per block to 32 static const unsigned max_lines_per_block_ = 32 in src/block.h allowed this to print. I tried this change only because reducing lines per block seemed to solve a similar issue before. Not exactly sure why... can @pdewacht shine some light?

abwillis commented 5 years ago

Printing the pdf to a Brother MFC-7365DN on OS/2 with brlaser 6 worked fine.

0xAl3xH commented 5 years ago

Interesting, I should add I'm printing this from Raspbian on a Raspberry Pi.

gtjeffw commented 4 years ago

I also had trouble with the HL-L2320D, specifically on a Raspberry Pi Zero W with Raspian. I recompiled with the max_lines_per_block_ = 32 change of @al3x-huang and now have a lot more success printing. I haven't done exhaustive testing but so far so good.

Before I discovered this discussion, I had some luck reducing to 300 dpi, but now I'm back to 600 with the previously mentioned fix.

I do still have issues with AirPrint (via avahi-discover). It only works some of the time, but I'm guessing that is potentially an unrelated issue.

randyoo commented 4 years ago

@al3x-huang THANK YOU!!!

I'm also printing from a Pi on Raspbian, with an HL-L2300D printer. I had been using brlaser v3, as included in the repo under printer-driver-brlaser. I noticed that simple documents seemed to print fine, but anything with a large-ish image would completely fail to print, but yielded no errors whatsoever. Your test document failed to print for me, as well.

I tried updating to self-compiled v6, but it didn't help. Recompiling with the lowered max lines per block declaration, as you suggested, solved the problem! I've also managed to print other documents that previously refused to print, so it looks like this completely resolves my issue. Thank you, thank you, thank you!

@pdewacht Should we open a pull request? Are there negative consequences to reducing max_lines_perblock to 32 instead of 64, other than performance?

RaeedAhmed commented 4 years ago

@al3x-huang Thanks so much. This is all very new to me, but I got my HL L2320D to print as well with your fix. I'm using a Raspberry Pi 3A as my print server, sharing the printer on my network.

I was able to print text documents just fine when using brlaser v4 with the 2300D driver (2320D not listed) but couldn't print any pdf files no matter the complexity. What's strange is printing test pages worked both directly through the CUPS web UI as well as built in Windows' Printers settings (in the case of CUPS it has some logos/images on the test page) so I'm not really sure what was causing issues.

I came across this forum and decided to build from source to get the v6 drivers (which has the 2320D listed), and also changed max_lines to 32 as well. Finally got it working!

rgilbert90 commented 4 years ago

@al3x-huang Thanks for your suggestion! Worked for my L2320D printer as well!

snejok commented 4 years ago

A had a problem with printing jpeg files, but reducing max_lines_perblock = 32 helps me too. Thank you @al3x-huang so much!

reinhard66-ubuntu commented 4 years ago

I stumbled upon a page that I was not able to print today: cant_print.pdf using v5. Can someone see if they can print it on other printers or versions and what might be the issue? Thanks!

Does not work for me either on Ubuntu using brlaser V6 and a Brother DCP-L2500D

0xAl3xH commented 4 years ago

I stumbled upon a page that I was not able to print today: cant_print.pdf using v5. Can someone see if they can print it on other printers or versions and what might be the issue? Thanks!

Does not work for me either on Ubuntu using brlaser V6 and a Brother DCP-L2500D

Could you try it with the fix described here and see if it works? Seems like it solves the issue for many others.

reinhard66-ubuntu commented 4 years ago

Thanks, yes i can confirm that this fix works. Looks like there is a need for a V6.1 package since all distro's uses the bad one then

stingray-11 commented 4 years ago

Also can confirm, was having issues with a HL-L2300D with version 4 in Debian Buster and this patch resolves them.

mathematicalmichael commented 4 years ago

can confirm that https://github.com/pdewacht/brlaser/pull/68 resolved my pdf printing issues on ubuntu 18 (x86)

pdewacht commented 4 years ago

Sorry, that was an accidental close.

I'm hesitant about your proposed change. It doesn't match what Brother's driver does, that driver will happily generate large blocks. It also doesn't seem to fix the issue for some people, e.g. in #40 somebody said he needed to reduce that constant to 16.

I made a different change that I think might be a better fix to the problem (not sure though, as I can't reproduce the problem with my own printer.) The Brother driver chooses its block size in such a way that a sequence of blocks always adds up to exactly 128 lines. brlaser didn't do that. But if you reduce max_lines_perblock, you make it much more likely for that to happen "by accident". Which would explain why this change worked.

@al3x-huang, can you try the master branch and see if you can still reproduce the problem with that version?

stingray-11 commented 4 years ago

I reverted the block size and updated to master. Haven't done extensive testing but I printed a few pages of a PDF and it does seem to work. I also tried the "can't print.pdf" and it worked, though I don't know whether it would've worked or not before. HL-L2300D.

mathematicalmichael commented 4 years ago

@pdewacht looks like my timing was just a bit off, glad I kept getting notifications for this thread... lol I still have #68 built and working on my printer, but from the sounds of it, rebuilding the driver from the current master is the "better" solution? I can attempt to print out what gave me trouble before if it'll help debug the issue (least I can do to thank you for this repo). I also have the HL-L2300D.

selcukgider commented 4 years ago

@al3x-huang, can you try the master branch and see if you can still reproduce the problem with that version?

@pdewacht for DCP-1610W printer rebuilding the driver from the current master seems to have fixed the issue for me.

0xAl3xH commented 4 years ago

@pdewacht yes can confirm building master resolves the original issue.

mathematicalmichael commented 4 years ago

also can confirm building from master works. didn't even have to reinstall the printer, simply restarting CUPS did it

reinhard66-ubuntu commented 4 years ago

can confirm too that it works.Doesn't need to restart CUPS, just did a new print job.

RussianNeuroMancer commented 4 years ago

If anyone need this, I published aarch64 build of latest stable release with applied https://github.com/pdewacht/brlaser/commit/9d7ddda8383bfc4d205b5e1b49de2b8bcd9137f1 in ppa:russianneuromancer/ppa

tuxerman commented 4 years ago

I had a similar issue with my brand new L2300D which stopped printing an image-heavy page (job listed as successful, but nothing printed). This was on a raspberry pi connected to the printer via USB and running CUPS. Compiling the latest master branch and installing V6 drivers seems to have fixed this. Thanks!

chrismorgan-hb commented 3 years ago

For the next person searching... Confirmed that rebuilding from master fixed a similar issue (couldn't print PDFs with images) for my HL-L2340D printing via a USB-connected Raspberry Pi.

tonivj5 commented 3 years ago

For the next person searching... Confirmed that rebuilding from master fixed a similar issue (couldn't print PDFs with images) for my HL-L2340D printing via a USB-connected Raspberry Pi.

I can confirm too! Using master works like a charm 👍🏻 Using Brother DCP-L2500D via Raspberry Pi Zero W

woffs commented 3 years ago

Confirm that master now prints fine on a HL-L2310D (while v6 fails if page contains larger areas of halftone). Maybe it's time for v7?

philmoreau commented 3 years ago

Can confirm the change worked on an HL-L2320D for a PDF that could only be printed at 300dpi before. It can now be printed at 600dpi. I would humbly suggest a new official release.

proteusvacuum commented 3 years ago

Can also confirm that building from master works to for an HL-2270DW. Thank you!

maozy commented 2 years ago

I can confirm the change fixed the issue on HL-L2320D connected to a Raspberry PI4 with Rasbian bullseye. It was failed to print certain PDFs (no clue how they are special), the printer light blinked but nothing came out. After changing the max_lines_perblock = 32, these PDFs can be printed properly. This issue and the fix were initially raised in 2019, now it's 2022 already, it is still not fixed in mainline?

stlouisubntu commented 2 years ago

Had the problem on Ubuntu 20.04 where some pdf (embedded images) would not print on my Brother HL-L2300D. Did the git clone and edited the src/block.h file (with vim) but the static const unsigned max_lines_perblock = 64; line was not present. Nevertheless, went ahead and inserted static const unsigned max_lines_perblock = 32; (right beneath the line static const unsigned max_blocksize = 16350; ) then did cmake . make sudo make install

then power off the printer and deleted the existing printers. Restarted cups sudo systemctl restart cups Then powered the printer back on and it was autodetected. The problematic pdfs not print fine.

Hereby gently and respectfully request that the fix for this be committed and pushed out.

Thank you for all your work on this. Much appreciate the issue notes without which I would not have been able to apply the fix.

DrewBrunning commented 2 years ago

Master still has this issue for me, but the branch from https://github.com/pdewacht/brlaser/pull/68 does, in fact, resolve the issue. For those looking to fix master, updating const int lines_per_band = 64; in job.cc to a value of 32 resolved the issue for me in the same way running the code from PR #68 did.

tonywu3 commented 3 weeks ago

Any updates to this issue? I took the latest release and still had to apply the fix for it print any pdfs.

The suggested fix to change the int to 32 did seem to fix a large portion of PDFs but I noticed it still has issues with some larger PDFs.