(Printer=SCX-4825FN via USB, OS=Ubuntu 12.04, driver=4.00.35 not from repo, problem=garbage printing from Chrome, Evince etc).
Another day, another discovery about my "garbage printing" problems: I've been able to fix them by writing output to the printer without delays (caused by ghostscript). Create a shellscript rastertosamsung.sh:
#!/bin/sh
`dirname $0`/rastertosamsungspl.orig "$@" >/var/tmp/output.$$
cat /var/tmp/output.$$
rm /var/tmp/output.$$
Then move the existing filter (so it can be run by the new one) and install the new one:
sudo mv -n /usr/lib/cups/filter/rastertosamsungspl /usr/lib/cups/filter/rastertosamsungspl.orig
sudo install -m 755 rastertosamsung.sh /usr/lib/cups/filter/rastertosamsungspl
You should be able to revert by reinstalling from the repo: apt-get --reinstall install samsungmfp-driver
Note 1: This seems to work for me but I haven't done much testing.
Note 2: This works as an alternative to my previous "samsungmfp-driver-pdf-fix" (pdftocairo) fix. In fact, it may be that the other fix works simply because ghostscript is able to run faster with the output from pdftocairo. You should probably remove the other fix with apt-get remove samsungmfp-driver-pdf-fix
Note 3: The rastertosamsungspl binary forks and starts ghostscript, then immediately writes the output header. It then waits for output from ghostscript before writing the rest of the output. I suspect the printer may be unhappy about the delay after receiving the header.
Note 4: If anyone has success with this fix, please post and let me know!
Oh, and if you're not happy with the instructions above, just paste the following into a terminal window. It has the same effect:
echo -e '#!/bin/sh\n`dirname $0`/rastertosamsungspl.orig "$@" >/var/tmp/output.$$\ncat /var/tmp/output.$$\nrm /var/tmp/output.$$' >rastertosamsung.sh
sudo mv -n /usr/lib/cups/filter/rastertosamsungspl /usr/lib/cups/filter/rastertosamsungspl.orig ; sudo install -m 755 rastertosamsung.sh /usr/lib/cups/filter/rastertosamsungspl