33

This has baffled me for a few weeks now. I have a Kyocera network printer set up in CUPS, and whenever I try to print to it I seem to end up with n² as many copies as I request. That is,

  • I try to print 2 copies of a document and I get 4
  • I try to print 5 copies of a document and I get 25
  • I try to print 60 copies of a document unattended, it runs out of paper, and I wander around the building depositing the extra copies in many recycling bins so as not to implicate myself too directly as the culprit

I cannot begin to imagine how to diagnose this, but besides being mildly amusing it does mean that to get my desired 60 copies of a document I have to go to some esoteric lengths (e.g. print 7 copies, print 3 copies, print 1 copy two times) which was amusing at first but has quickly gotten old.

So I am posting here in the hopes that someone can reassure me that I am not crazy, and hope that maybe someone might have experienced this before and know of a way to fix it?

I am printing a PDF from Document Viewer 3.18.2

ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
Mala
  • 610
  • 7
  • 16
  • 1
    Well, if you want to diagnose this, you could try using `gtklp`, which is a fairly direct interface with CUPS, I think. Additionally, try `lpr`, which is also a direct interface with CUPS, provided you have the relevant bit of CUPS installed. On Debian it is `cups-bsd`. – Faheem Mitha Feb 24 '16 at 18:29
  • 5
    +1 It sounds like your software sends N times a request to the printer for N copies of your doc! – L. Levrel Feb 25 '16 at 12:34
  • 9
    "...to get my desired 60 copies of a document I have to go to some esoteric lengths (e.g. print 7 copies, print 3 copies, print 1 copy two times) which was amusing at first but has quickly gotten old." Clearly the solution is to fob the mathematics off onto a computer program. Luckily, Wolfram Alpha knows how to calculate the answer for you: give it "[60 sum of squares](http://www.wolframalpha.com/input/?i=60+sum+of+squares)" and you get back three solutions, one of which is the 7² + 3² + 1² + 1² solution you came up with on your own. Problem solved. :) – Warren Young Apr 16 '16 at 22:42
  • 6
    Incidentally, by [Lagrange's four-square theorem](https://en.wikipedia.org/wiki/Lagrange%27s_four-square_theorem), every positive integer is the sum of four squares. – Alexey Jun 29 '16 at 14:43
  • 2
    I don't have the answer, but given that you consistently get n² copies suggests that you have a pipeline in which more than one member is performing the 'x*n*' operation and (at least the first of those) is not removing that option as it processes it. Perhaps that helps you diagnose the problem? – Toby Speight Jun 29 '16 at 16:21
  • seems similar: http://www.linuxquestions.org/questions/linux-server-73/cups-too-many-copies-4175475488-print/ – Rui F Ribeiro Jul 07 '16 at 19:09
  • @alexey that is the sum of 4 or fewer squares. It could be the sum of 1, 2, or 3 squares also. e.g. 9 = 3², 29 = 5² + 2² – ctrl-alt-delor Jul 09 '16 at 22:33
  • Have you solved this yourself, if so then can you add an answer, else amend question, to tell us what you have tried and what happened. – ctrl-alt-delor Jul 09 '16 at 22:36
  • 4
    @richard : 9 = 3^2 + 0^2 + 0^2 + 0^2. – Alexey Jul 10 '16 at 07:54
  • @mala Is CUPS doing this with all programs you try to print from or just Document Viewer? And which distro are you using? (I know Ubuntu at least has given me issues with conflicting CUPS settings in multiple locations.) – Boxbot Aug 18 '16 at 22:11
  • Hi, I stumbled upon this exact problem, however, I can't find any CUPSOPTION variable in the filter file. The setup is somewhat more complicated because the printer is shared over network and configured as a "Raw" printer on the host while being configured properly on the client. So I assume that the filter file in question is the one on the client. Here is its content: https://pastebin.com/1gf1jdC9 Running the lp command in the top answer on the client prints 4 copies, running it on the host prints nothing (since the printer is configured as "Raw" there). Any ideas what could be wrong here? – Photon Dec 25 '18 at 21:04
  • @Photon Did you ever solve your issue? `grep CUPSOPTION -r /usr/lib/cups/filter` comes up empty. – Sparhawk Jul 30 '19 at 02:15
  • @Sparhawk Not really, I just switched to the official binary drivers on the server (which in the mean time are available for ARM and thus run on my Raspberry Pi) rather than running them on the client. By this switch the problem has gone. – Photon Jul 30 '19 at 06:48
  • Thanks for the reply @Photon. I'll try to investigate alternative drivers. – Sparhawk Jul 30 '19 at 08:06
  • I understand that this was posted quite a long time ago, but it may be useful if OP added more context to its question - i.e. which linux distribution is running and which version of it, mostly because the problem seems to be related to CUPS more than actual PDF viewer used. – gerlos Nov 12 '19 at 10:09
  • i have same issue on mx-linux 21.3 and several hp printers, network and wifi coonnected – Laurencio deGiuffra Jun 16 '23 at 16:55
  • I have got the same issue on MX-Linux 21.3 (Debian 11 base), using several hp printers. – Laurencio deGiuffra Jun 16 '23 at 17:22

2 Answers2

5

FWIW, I had the very same issue with a Brother QL-1050 label printer, under Debian Sid. It was not an application bug as suggested in comments, but a CUPS/driver issue. You can confirm this by running lp or lpr and see if it is affected as well :

lp -d YOURPRINTER -n 2 /some/file.pdf
lpr -P YOURPRINTER -# 2 /some/file.pdf

I managed to solve the problem by editing /usr/lib/cups/filter/brother_lpdwrapper_ql1050, and modifying the line

CUPSOPTION=`echo "$5 Copies=$4" | sed -e …

into

CUPSOPTION=`echo "$5" | sed -e …

(Copies=1 also works).

I guess the number of copies was feeded twice somehow.

There must be a similar file for your printer, and though I guess the name and definition of CUPSOPTION may vary, those options are probably defined there.

  • 1
    Hi, I stumbled upon this exact problem, however, I can't find any CUPSOPTION variable in the filter file. The setup is somewhat more complicated because the printer is shared over network and configured as a "Raw" printer on the host while being configured properly on the client. So I assume that the filter file in question is the one on the client. Here is its content: https://pastebin.com/1gf1jdC9 Running the lp command in your answer on the client prints 4 copies, running it on the host prints nothing (since the printer is configured as "Raw" there). Any ideas what could be wrong here? Thx! – Photon Dec 25 '18 at 21:04
  • 1
    @Photon I had a look at your pastebin, but I'm afraid I can't be of much help. Good luck. – Skippy le Grand Gourou Dec 25 '18 at 21:33
  • Thanks for the quick reply! I'll post in case I figure it out, I'm somewhat pessimistic yet though. :) – Photon Dec 25 '18 at 21:38
  • 1
    I'm having the same problem. How do you work out which filter file to modify? Also, FWIW, `grep CUPSOPTION -r /usr/lib/cups/filter` is empty on my system. – Sparhawk Jul 30 '19 at 02:16
  • @Sparhawk I believe filters are named after the printer model. Aside from that I can only reiter my answer to Photon : if the answer doesn't fix the problem by itself, I'm afraid I can't be of much help, and wish you good luck. – Skippy le Grand Gourou Jul 30 '19 at 07:54
  • No worries; thank you. I only asked in case this related to a later update to the filters. Thank you for the reply. – Sparhawk Jul 30 '19 at 07:55
  • 1
    thankyou very much, this worked for me with a brother ql570 printer – Amphibio Apr 16 '20 at 11:54
-1

As you are using "Document Viewer 3.18.2" (which seems to be an Android application: https://play.google.com/store/apps/details?id=org.sufficientlysecure.viewer), may I suggest you try printing from a Windows and then a Linux PC connected to the printer.

With Windows it will check whether the config at printer end is OK. With Linux you can check the CUPS settings. On the Linux side, try printing with both a viewer like Evince and the command line. For command line printing the page at: https://www.cups.org/doc/options.html gives a lot of information.

SACHIN GARG
  • 110
  • 4