Printing problems
Hi to all,
In order to gradually eliminate my fax I have written a bash script that print automatically an email with or without attachment. The sctipt do the following job: 1) Every 5 min check automatically for an emails (external email account) 2) Download it one by one and convert the plain text/html in a postscript file and save it in a folder. If there is an attachment (like a jpg or PDF) it extract it from the email and save it in the same folder as pdf. 3) Send to the printer (lp command) the saved files. 4) Delete the files 5) Send an email to inform that an email was received and inform of the printing status To do the job I use a raspberry PI. This script runned well with Raspbian Jessy until last month I noticed that some PDF couldn't be printed correctly. Reading Debian information I need to upgrade a hplip package but a new one was included only in raspbian 9. So I upgraded to version 9 but now I have more problems. Here a list of it. 1) I had to put in my script a sleep command of 5-10 second in the loop that read the saved files and send it for printing. If not only the first file will be printed, the other will be lost(where?) also if they are sent correctly to the printer (I can see the job in cups and also in the printer log) 2) CUPS now indicate all the printed and also the not printed jobs as "canceled" and no more as "completed". Why? 3) Most of the time only a part of a page of the whole pdf or plain txt files will be printed (half a page or so). The rest of the page and the additonal pages will not be printed. If I view the .ps or .pdf the files are not corrupted. Any ideas how to start solve this problem? Thanks Gian Carlo |
Welcome to LinuxQuestions.org Gian Carlo.
Does a test page print ok? Code:
hp-testpage Quote:
|
Also, with respect to the hplip environment, check that all is well on your new install...
Code:
hp-check -t |
Hi Ferrari,
thanks for your reply. Here the answer of the commands: hp-testpage HP Linux Imaging and Printing System (ver. 3.16.11) Testpage Print Utility ver. 6.0 Copyright (c) 2001-15 HP Development Company, LP This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to distribute it under certain conditions. See COPYING file for more details. error: No device found that support this feature. error: No installed printers found (or) Invalid printer device selected hp-check -t error: avahi-utils avahi-utils OPTIONAL - - MISSING 'avahi-utils needs to be installed' scanimage scanimage - Shell scanning program OPTIONAL 1.0 1.0.25 OK - error: dbus DBus - Message bus system REQUIRED - 1.10.26 MISSING 'DBUS may not be installed or not running' gs GhostScript - PostScript and PDF language interpreter and previewer REQUIRED 7.05 9.20 OK - error: xsane xsane - Graphical scanner frontend for SANE OPTIONAL 0.9 - MISSING 'xsane needs to be installed' network network -wget OPTIONAL - 1.18 OK - error: cups CUPS - Common Unix Printing System REQUIRED 1.1 - INCOMPAT 'CUPS may not be installed or not running' policykit PolicyKit - Administrative policy framework OPTIONAL - 0.105 OK - ---------------------- | Scan Configuration | ---------------------- scanext Scan-SANE-Extension REQUIRED - 3.16.11 OK -'/etc/sane.d/dll.d/hpaio' not found. hpaio HPLIP-SANE-Backend REQUIRED - 3.16.11 OK 'hpaio found in /etc/sane.d/dll.conf' --------------------- | Python Extentions | --------------------- cupsext CUPS-Extension REQUIRED - 3.16.11 OK - hpmudext IO-Extension REQUIRED - 3.16.11 OK - ------------------------ | General Dependencies | ------------------------ error: libusb libusb - USB library REQUIRED - 1.0 MISSING 'libusb needs to be installed' python3X Python 2.2 or greater - Python programming language REQUIRED 2.2 3.5.3 OK - error: python3-pyqt4-dbus PyQt 4 DBus - DBus Support for PyQt4 OPTIONAL 4.0 - MISSING 'python3-pyqt4-dbus needs to be installed' error: python3-devel Python devel - Python development files REQUIRED 2.2 3.5.3 MISSING 'python3-devel needs to be installed' error: libjpeg libjpeg - JPEG library REQUIRED - - MISSING 'libjpeg needs to be installed' error: sane-devel SANE - Scanning library development files REQUIRED - - MISSING 'sane-devel needs to be installed' error: cups-devel CUPS devel- Common Unix Printing System development files REQUIRED - - MISSING 'cups-devel needs to be installed' python3-reportlab Reportlab - PDF library for Python OPTIONAL 2.0 3.3.0 OK - error: cups-image CUPS image - CUPS image development files REQUIRED - - MISSING 'cups-image needs to be installed' sane SANE - Scanning library REQUIRED - - OK - error: libcrypto libcrypto - OpenSSL cryptographic library REQUIRED - 1.1.0 MISSING 'libcrypto needs to be installed' error: libnetsnmp-devel libnetsnmp-devel - SNMP networking library development files REQUIRED 5.0.9 - MISSING 'libnetsnmp-devel needs to be installed' error: python3-pyqt4 PyQt 4- Qt interface for Python (for Qt version 4.x) REQUIRED 4.0 - MISSING 'python3-pyqt4 needs to be installed' python3-dbus Python DBus - Python bindings for DBus REQUIRED 0.80.0 1.2.4 OK - libpthread libpthread - POSIX threads library REQUIRED - b'2.24' OK - python3-xml Python XML libraries REQUIRED - 2.2.0 OK - python3-pil PIL - Python Imaging Library (required for commandline scanning with hp-scan) OPTIONAL - 1.1.7 OK - error: python3-notify2 Python libnotify - Python bindings for the libnotify Desktop notifications OPTIONAL - - MISSING 'python3-notify2 needs to be installed' -------------- | COMPILEDEP | -------------- make make - GNU make utility to maintain groups of programs REQUIRED 3.0 4.1 OK - gcc gcc - GNU Project C and C++ Compiler REQUIRED - 6.3.0 OK - error: libtool libtool - Library building support services REQUIRED - - MISSING 'libtool needs to be installed' ------------------------------ | DISCOVERED SCANNER DEVICES | ------------------------------ No Scanner found. -------------------------- | DISCOVERED USB DEVICES | -------------------------- No devices found. --------------------------------- | INSTALLED CUPS PRINTER QUEUES | --------------------------------- HP_Color_LaserJet_CM2320nf_MFP ------------------------------ Type: Unknown Device URI: socket://192.168.6.35 PPD: /etc/cups/ppd/HP_Color_LaserJet_CM2320nf_MFP.ppd warning: Failed to read /etc/cups/ppd/HP_Color_LaserJet_CM2320nf_MFP.ppd ppd file PPD Description: Printer status: printer HP_Color_LaserJet_CM2320nf_MFP is idle. enabled since Wed 25 Jul 2018 15:05:40 UTC warning: Printer is not HPLIP installed. Printers must use the hp: or hpfax: CUPS backend for HP-Devices. HP_HP_Color_LaserJet_CM2320nf_MFP --------------------------------- Type: Unknown Device URI: dnssd://HP%20Color%20LaserJet%20CM2320nf%20MFP%20(03AC46)._pdl-datastream._tcp.local/ PPD: /etc/cups/ppd/HP_HP_Color_LaserJet_CM2320nf_MFP.ppd warning: Failed to read /etc/cups/ppd/HP_HP_Color_LaserJet_CM2320nf_MFP.ppd ppd file PPD Description: Printer status: printer HP_HP_Color_LaserJet_CM2320nf_MFP is idle. enabled since Fri 20 Jul 2018 13:01:45 UTC warning: Printer is not HPLIP installed. Printers must use the hp: or hpfax: CUPS backend for HP-Devices. -------------- | PERMISSION | -------------- ----------- | SUMMARY | ----------- Missing Required Dependencies ----------------------------- error: 'libdbus-1-dev' package is missing/incompatible error: 'cups' package is missing or 'cups' service is not running. error: 'libcups2' package is missing/incompatible error: 'libusb-1.0.0-dev' package is missing/incompatible error: 'python3-dev' package is missing/incompatible error: 'libjpeg62-turbo-dev' package is missing/incompatible error: 'libsane-dev' package is missing/incompatible error: 'libcups2-dev' package is missing/incompatible error: 'cups-bsd' package is missing/incompatible error: 'cups-client' package is missing/incompatible error: 'libcupsimage2' package is missing/incompatible error: 'libcupsimage2-dev' package is missing/incompatible error: 'libssl-dev' package is missing/incompatible error: 'libsnmp-dev' package is missing/incompatible error: 'snmp' package is missing/incompatible error: 'python3-pyqt4' package is missing/incompatible error: 'gtk2-engines-pixbuf' package is missing/incompatible error: 'libtool' package is missing/incompatible error: 'libtool-bin' package is missing/incompatible Missing Optional Dependencies ----------------------------- error: 'avahi-utils' package is missing/incompatible error: 'xsane' package is missing/incompatible error: 'python3-dbus.mainloop.qt' package is missing/incompatible error: 'python3-notify2' package is missing/incompatible Total Errors: 16 Total Warnings: 2 Here my code: Code:
#!/bin/bash |
The printer backend is wrong (for HPLIP printer)...
Code:
HP_Color_LaserJet_CM2320nf_MFP |
Hi Ferrari,
I have deleted all the printers and run the hp-setup command in interactive mode ( hp-setup -i IP-Address) because I have no X server on the PI. Now it seems all working. I will check next days more in details. But why it doesn't work when I install the driver from cups? An all the other errors from command "hp-check -t". Do I have to fix it? Thanks 4 your help Regards Gian Carlo |
Good to read that the HP printer is now working. HP printers supported by HPLIP can be configured directly via the CUPS web interface but the appropriate backend and drivers need to be selected. It’s easier just to use the HPLIP tools.
If it’s working, don’t worry about the dependency issues, most are due to ‘over-cautious’ versioning checks. It is possible to use ‘hp-doctor’ to help lresolve some issues automatically, but I don’t think that’s needed here. |
Hi again Ferrari,
I have made some tests and in PDF I noticed that if the the page is landscape and not portrait, only a part of the landscape page will be printed. I have a PDF with 3 pages and the second is landscape. It will be printed only a part of it. The 1st and the 3rd are printed ok. I noticed also that in this PDF cups tell me that the state is canceled What could be? Gian Carlo |
Which application are you using here? I've never tried printing a multi-page document containing both landscape and portrait pages. I do recall long discussions and bug reports about how CUPS should handle page orientation/roatation/scaling etc. I haven't encountered any issues over the past few years (but my printing requirements are modest). Out of interest how is this 3-page documented reported by pdfinfo (part of poppler-tools)?
Code:
pdfinfo /path/to/your/file.pdf Is there a print dialogue option to adjust scaling with 'fit to paper' or similar? |
1 Attachment(s)
Hi Ferrari,
the pdfinfo command give me the following result: CreationDate: Tue Jul 31 16:54:08 2018 UTC Tagged: no UserProperties: no Suspects: no Form: none JavaScript: no Pages: 3 Encrypted: no Page size: 595.08 x 841.68 pts Page rot: 0 File size: 653560 bytes Optimized: no PDF version: 1.4 In the attachment you can find the error log file of cups. I eliminated the rest and job 1999 is the PDF job. argv[5] are "finishings=3 fit-to-page media=A4,tray1 number-up=1 position=top scaling=100 job-uuid=urn:uuid:022e0d6b-5c40-3268-67ea-132f244af901 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1533193228 time-at-processing=1533193228 document-name-supplied=doc04408120180731165353.pdf PageSize=A4" I can't see critical errors in printing the pdf. Gian Carlo |
Yes, the error log looks as expected. The CUPS filter chain is pdftopdf > pdftops > application/vnd.cups-postscript, and it is here where any rotataton and/or scaling takes place. A bug report may be needed here. Again, which PDF viewing application is involved here?
|
Ever since Apple stopped development of cups for Linux, the cups-filters package has had problems that can only be solved by the new Linux cups development team via bug reports.
|
Quote:
to view the PDF I download locally because the raspberry doesn't have a graphical interface, and I use Xreader; to print it I use the standard lp command ( in the script is the line LP_OUTPUT=$(lp $LP_OPTIONS "$f") ) the same as for postscript and plain text. Gian Carlo |
Quote:
|
My printer requires extra steps in debian. It needs the pnm2ppa part. Plus others:
printer-driver-hpcups printer-driver-pnm2ppa printer-driver-postscript-hp hplip hplip-data cups-bsd some of which are not installed by default. For the remote clients I need to be in the lp and lpadmin groups plus an entry for the hostname in /etc/hosts on the clients (statically configured IPs). And other admin steps. # lpstat -a # lpoptions -d HP_DESKJET_720C_rpi3bplus To make it the default printer. Most times when it doesn't work, I forgot to plug the usb to parallel port adapter in. Or I disabled cups, cups-browsed, or exim4 from running on both ends. Cups does job management via email / exim4. When none of the above works, a reboot with the printer plugged in and turned on solves most woes. But I'm a bit of a minimalist and stop various things from running to save CPU, RAM, thermals and such with a shorter than default ps output. When none of that works finding the correct .ppd and putting it with all the other ppd's helps. |
All times are GMT -5. The time now is 01:43 AM. |