This gem brings cups interaction into Thecore apps, allowing printing on all configured printers (be they local or remote), using cups' standardized interface.
Add all the needed printers and be sure you can print on them. to add printers to CUPS you can use http://localhost:631, but before it could be bettere to relax a bit the authentications needed for adding printers, to do so, please edit /etc/cups/cupsd.conf and replace all the Authentication directives with Authentication None.
When you enter the printers section and add a new printer in Thecore backend, you'll just see available (through cups) printers and you can just select one of these.
Otherwise, if you prefere to go the shell way, you can add it using lpadmin, say you'd like to install a samba printer:
First of all add current user to lpadmin group:
sudo apt install cups libcups2-dev gridsite-clients smbclient
sudo adduser $(whoami) lpadmin
newgrp lpadmin
Then you can use lpadmin commands without sudo (example for samba shared printer, must be adapted for other protocols):
echo "Printer label:"; read PRINTERLABEL;
echo "Printer workgroup or Domain:";read WORKGROUP;
echo "Printer ip or netbios address:";read SHARE_IP_ADDRESS_OR_NETBIOS_NAME;
echo "Printer share name:";read SHARENAME;
echo "Printer share username:"; read USERNAME;
echo "Printer share password:"; read PASSWORD;
lpadmin -p "$PRINTERLABEL" -E -v "beh://1/1/1/smb://$(urlencode $USERNAME):$(urlencode $PASSWORD)@$(urlencode $WORKGROUP)/$(urlencode $SHARE_IP_ADDRESS_OR_NETBIOS_NAME)/$(urlencode $SHARENAME)" -m everywhere
To list shares on that remote machine:
smbclient -L $(urlencode $SHARE_IP_ADDRESS_OR_NETBIOS_NAME) -U $(urlencode $USERNAME)%$(urlencode $PASSWORD) -W $(urlencode $WORKGROUP)
To test from shell, prior to start using the rails ui:
echo "Hello" > testprint
lp -d "$PRINTERLABEL" -o raw testprint
First of all, please install libcups2-dev:
sudo apt install libcups2-dev
Add this line to your application's Gemfile:
gem 'thecore_print_commons'
And then execute:
$ bundle
Or install it yourself as:
$ gem install thecore_print_commons
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.