Creating a raw printer queue in CUPS (host) and adding them through CUPS (client)
[...] how to create a raw queue on the RasPi
From the Pi (or an SSH/Putty session) add yourself to the lpadmin group
sudo adduser $USER lpadmin
Enable remote administration (or manually)
sudo cupsctl --remote-admin
Cycle CUPS to make sure it likes you
sudo service cups restart
-- OR --sudo /etc/init.d/cups restart
Navigate to http://localhost:631 (of if you don't have keyboard access:
http://<ip_address_of_pi>:631
from another machine)Navigate to Administration, Add Printer
a. When prompted to login, use your standard username and password.
b. Note: If the password doesn't work,
sudo reboot
, try again.AppSocket/HP JetDirect, then:
a. Network Attached:
socket://<ip_of_printer>:9100
b. USB Attached:
socket://<usb_handle>
find usinglpinfo -v |grep usb:
, you don't need the "? location=1a200000" information. Assumes proper driver is installed first. Note, if your device driver isn't offered for ARM architecture, see this article.Make: Raw (NOT Generic)
- Name It, Share It, Continue
Go back to CUPS Administration page at http://localhost:631
a. Enable printer sharing via:.[X] Share printers connected to this system
. [X] Allow printing from the internet
[...] how to access it from the clients
This varies greatly between platforms.
The general URL format is:
http://<ip_of_pi>:631/printers/<name_used_in_step_8_above>
a. Windows: Devices and Printers, Add Printer (NOT Add Device, it's in the toolbar), Manually Select/Not Listed, Local or Network Printer with Manual Settings, Create a new port, Standard TCP/IP Port
b. MacOS: Enable, then use the CUPS web interface. The GUI can't do it. You'll need to be in admin group and know your user id (e.g.
echo $USER
)c. Linux: Using the GUI or CUPS, Network Printer, AppSocket/HP JetDirect
CUPS bypassing interface
The printqueues you have are NOT 'raw' ones!
First, you seem to not be aware what a raw print queue is in CUPS' parlance: a raw queue is one that is not associated with...
...neither an interface script (a script by the same name as the queue itself located in
/etc/cups/interfaces/
),...nor a PostScript Printer Description (PPD) file (a PPD file by the same name as the queue itself with the additional suffix *.ppd, located in
/etc/cups/ppd/
).
Since you say you've installed an interface script for your printer queues, by definition these are NOT raw queues!
To send jobs as raw (that means: unfiltered) to non-raw CUPS queues, there is no other way than to use -o raw
on the lp
commandline. You can also use (alternatively) the option -o document-format=application/vnd.cups-raw
... but this has the exactly same meaning: it causes CUPS to use the same job handling and is just 7x more keyboard keys to punch.
Both ways cause CUPS to skip the step of auto-typing the incoming job file and pass it through unfiltered to the queue's backend.
The auto-typing step and its result can be observed in the log file /var/log/cups/error_log
by looking for the keyword Auto-typing
once your cupsd.conf
has LogLevel debug
enabled: the line mentioning Request file type is ...
tells you which MIME type CUPS classifies your incoming job as.)
How to force CUPS to handle incoming print data as text
Use the -o document-format=text/plain
in the lp
command line.
How to setup CUPS 'raw' queues
If you want to turn (any) existing print queue into a raw one, just delete the associated PPD file (/etc/cups/ppd/myprinter.ppd
) or the associated interfaces script (/etc/cups/interfaces/myprinter
).
If you want to install a print queue to act as a raw one from the beginning, just use the printername and the backend URI, but do not specify any PPD nor any interface script to be associated with it:
Example command to install a 'raw' print queue:
sudo lpadmin -p my_raw_printer -E -v socket://192.168.177.188:9100
(The -p
is to specify the print queue name, the -E
is to enable the print queue from the beginnning.)
Speculation: why 2nd application may be by-passing your interface script
Without seeing your complete system setup and looking at the 2nd application (whose printing seems to behave differently from your 1st one), or without access to a debug level CUPS error_log
file , it's only possible to speculate:
- my guess is that your 2nd application uses some hard-wired print command which implicitly uses the
-o raw
print command option.
Printing using CUPS via Internet
Access the CUPS admin page (e.g.: http://localhost:631/admin
) and enable the following options: "Share printers connected to this system" and "Allow printing from the Internet are checked".
How to us a Printer in Lua and cups
Open a pipe to lpr
and write to it:
out = assert(io.popen("lpr","w"))
out:write("Hello\n")
out:close()
If lpr
does not work, try lp
.
Related Topics
Is Clock_Gettime() Adequate for Submicrosecond Timing
How to Prevent Out of Memory (Oom) Freezes on Linux
Unable to Start Rstudio in Centos Getting Error "Unable to Connect to Service"
Searching Multiple Patterns (Words) with Ack
Installing Mod_Ssl Amazon Linux
Get a Nanosecond-Precise Atime, Mtime, Ctime Fields for File (Stat)
Linux Assembly: How to Call Syscall
Running Scheme from the Command Line
What Does the Gcc Error Message, "Error: Unsupported for 'Mov'", Mean
Putting Two Consecutive Lines into One Line with Perl/Awk
How to Split a Ca Certificate Bundle into Separate Files
When Should Xargs Be Preferred Over While-Read Loops
How to Open a File in Assembler and Modify It
"Current" in Linux Kernel Code
How to Check a File Exists and Execute a Command If Not
Converting Avi Frames to Jpgs on Linux
Vim: Access to System Clipboard via Ssh - Linux to Os X
I Cannot Get a Result from a Single Line Put into the Erlang Shell