no way to compare when less than two revisions
Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
| — | hardware:jednodeskove-pocitace:raspberry-pi:raspberrypi-lan-print-scan-and-pdf-server [2026/03/09 14:44] (aktuální) – Migrace Raspberry Pi LAN serveru do nove hardware IA Petr Nosek | ||
|---|---|---|---|
| Řádek 1: | Řádek 1: | ||
| + | ====== Ultimate Raspberry Pi: LAN Print, Scan and PDF Server ====== | ||
| + | Článek jsem měl historicky uložený a pochází ze zdroje, který už neexistuje. Jeho přesná název zněl: **Ultimate Raspberry Pi : LAN Print , Scan and PDF Server : CUPS + AirPrint + IPP + cups-pdf + sanescan ( SaneTwain ) + phpSANE / PHP-Scanner-Server ( scanner webinterface ) + samba ( remote file access )**. | ||
| + | |||
| + | Datum článku byl 2.4.2014. Samozřejmě už některé věci nebudou aktuální a je potřeba se přizpůsobit. Dávám zde alespoň přepis článku. | ||
| + | |||
| + | ===== Assumptions ===== | ||
| + | * Completed Ultimate Raspberry Pi : Preparation and with optional server preparation. | ||
| + | * Raspberry Pi IP address: **192.168.1.111** | ||
| + | |||
| + | ===== Install Dependencies ===== | ||
| + | <code bash> | ||
| + | apt-get update && apt-get install -f avahi-daemon cups cups-pdf python-cups avahi-discover libnss-mdns sane-utils xinetd printer-driver-gutenprint system-config-printer-udev | ||
| + | </ | ||
| + | |||
| + | **Optional: Install one of the relevant printer drivers** | ||
| + | <code bash> | ||
| + | apt-get install printer-driver-c2050 #printer driver for Lexmark 2050 Color Jetprinter | ||
| + | apt-get install printer-driver-c2esp #printer driver for Kodak ESP AiO color inkjet Series | ||
| + | apt-get install printer-driver-cjet #printer driver for Canon LBP laser printers | ||
| + | apt-get install printer-driver-escpr #printer driver for Epson Inkjet that use ESC P-R | ||
| + | apt-get install printer-driver-foo2zjs #printer driver for ZjStream-based printers | ||
| + | apt-get install printer-driver-gutenprint #printer drivers for CUPS | ||
| + | apt-get install printer-driver-hpcups #HP Linux Printing and Imaging - CUPS Raster driver (hpcups) | ||
| + | apt-get install printer-driver-hpijs #HP Linux Printing and Imaging - gs IJS driver (hpijs) | ||
| + | apt-get install printer-driver-m2300w #printer driver for Minolta magicolor 2300W 2400W color laser printers | ||
| + | apt-get install printer-driver-min12xxw #printer driver for KonicaMinolta PagePro 1[234]xxW | ||
| + | apt-get install printer-driver-pnm2ppa #printer driver for HP-GDI printers | ||
| + | apt-get install printer-driver-postscript-hp #HP Printers PostScript Descriptions | ||
| + | apt-get install printer-driver-ptouch #printer driver Brother P-touch label printers | ||
| + | apt-get install printer-driver-pxljr #printer driver for HP Color LaserJet 35xx 36xx | ||
| + | apt-get install printer-driver-sag-gdi #printer driver for Ricoh Aficio SP 1000s SP 1100s | ||
| + | apt-get install printer-driver-splix #Driver for Samsung and Xerox SPL2 and SPLc laser printers | ||
| + | </ | ||
| + | |||
| + | ===== Configure cups to listen on the LAN ===== | ||
| + | <code bash> | ||
| + | sed -i " | ||
| + | </ | ||
| + | |||
| + | ===== Allow LAN access to CUPS ===== | ||
| + | <code bash> | ||
| + | sed -i " | ||
| + | </ | ||
| + | |||
| + | ===== Add the server name and browse address ===== | ||
| + | Replace **192.168.1.255** with your LAN broadcast address. | ||
| + | <code bash> | ||
| + | echo -e " | ||
| + | sed -i -e " | ||
| + | </ | ||
| + | |||
| + | ===== Restart CUPS ===== | ||
| + | <code bash> | ||
| + | service cups restart | ||
| + | </ | ||
| + | |||
| + | ===== Add the pi user to the lpadmin group ===== | ||
| + | <code bash> | ||
| + | adduser pi lpadmin | ||
| + | </ | ||
| + | |||
| + | ===== Enable print sharing and remote administration ===== | ||
| + | <code bash> | ||
| + | cupsctl --share-printers --remote-admin --remote-printers | ||
| + | sed -i " | ||
| + | lpoptions -d PDF -o printer-is-shared=true | ||
| + | </ | ||
| + | |||
| + | ===== Custom cups-pdf output directory ===== | ||
| + | **PDF storage directory: / | ||
| + | <code bash> | ||
| + | mkdir -p / | ||
| + | chown root: | ||
| + | chmod 777 / | ||
| + | </ | ||
| + | |||
| + | ===== Append the date to the PDF file name ===== | ||
| + | <code bash> | ||
| + | mkdir -p / | ||
| + | cat > / | ||
| + | #!/bin/bash | ||
| + | ## eXtremeSHOK.com | ||
| + | FILENAME=`basename $1` | ||
| + | DIRNAME="/ | ||
| + | DATE=`date +" | ||
| + | mv $1 $DIRNAME"/" | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | ===== Enable cups-pdf post processing ===== | ||
| + | <code bash> | ||
| + | chmod 777 / | ||
| + | chown root: | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | </ | ||
| + | |||
| + | ===== Enable automatic retrying of failed print jobs ===== | ||
| + | <code bash> | ||
| + | sed -i -e " | ||
| + | </ | ||
| + | |||
| + | ===== Restart CUPS ===== | ||
| + | <code bash> | ||
| + | service cups restart | ||
| + | </ | ||
| + | |||
| + | ===== Configure your printer ===== | ||
| + | Visit the web interface: **https:// | ||
| + | |||
| + | **Steps:** | ||
| + | * Log in using: | ||
| + | * **Admin username:** pi | ||
| + | * **Admin password:** raspberry | ||
| + | * Navigate to **Administration -> Find New Printers** | ||
| + | * Add your printer and enable **Share This Printer** | ||
| + | * Select your make and model or specify a PPD file. | ||
| + | * Restart services: | ||
| + | <code bash> | ||
| + | service cups restart | ||
| + | service avahi-daemon restart | ||
| + | </ | ||
| + | |||
| + | ===== Optional: Enable AirPrint ===== | ||
| + | **(Not needed on iOS 7 and above)** | ||
| + | |||
| + | Enhanced iOS support: | ||
| + | <code bash> | ||
| + | echo " | ||
| + | mkdir / | ||
| + | cd / | ||
| + | wget -O airprint-generate.py --no-check-certificate https:// | ||
| + | chmod +x airprint-generate.py | ||
| + | ./ | ||
| + | </ | ||
| + | |||
| + | ===== Using your PDF postscript printer via IPP ===== | ||
| + | **Driver: Microsoft Windows** | ||
| + | * **Manufacturer: | ||
| + | * **Printer: | ||
| + | |||
| + | Via IPP: | ||
| + | Use the following as the printer' | ||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ===== Using your printer via IPP ===== | ||
| + | **Driver: Microsoft Vista and 7/8** | ||
| + | * **Manufacturer: | ||
| + | * **Printer: | ||
| + | |||
| + | **Driver: Microsoft 2000 and XP** | ||
| + | * **Manufacturer: | ||
| + | * **Printer: | ||
| + | |||
| + | Via IPP: | ||
| + | Use the following as the printer' | ||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ===== Optional: Enable Scanning ===== | ||
| + | **Enable scanning support and share a scanner on your network** | ||
| + | |||
| + | Install: | ||
| + | <code bash> | ||
| + | apt-get install -f sane-utils xinetd | ||
| + | </ | ||
| + | |||
| + | Enable the saned service: | ||
| + | <code bash> | ||
| + | echo -e " | ||
| + | sed -i " | ||
| + | </ | ||
| + | |||
| + | Enable the xinetd sane service: | ||
| + | <code bash> | ||
| + | cat > / | ||
| + | # eXtremeSHOK.com | ||
| + | service saned { | ||
| + | socket_type = stream | ||
| + | server = / | ||
| + | protocol = tcp | ||
| + | user = saned | ||
| + | group = scanner | ||
| + | wait = no | ||
| + | disable = no | ||
| + | } | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | **BUG FIX:** Scanner not working: usbfs: interface 1 claimed by usblp while `scanimage` sets config #1: | ||
| + | <code bash> | ||
| + | echo -e " | ||
| + | </ | ||
| + | |||
| + | Reboot: | ||
| + | <code bash> | ||
| + | sync && shutdown -r now | ||
| + | </ | ||
| + | |||
| + | Verify the scanner is supported and listening: | ||
| + | <code bash> | ||
| + | scanimage -L | ||
| + | </ | ||
| + | |||
| + | Example output: | ||
| + | < | ||
| + | device `xerox_mfp: | ||
| + | </ | ||
| + | |||
| + | Verify the service: | ||
| + | <code bash> | ||
| + | cat / | ||
| + | </ | ||
| + | |||
| + | Example output: | ||
| + | < | ||
| + | sane-port 6566/tcp sane saned # SANE network scanner daemon | ||
| + | </ | ||
| + | |||
| + | ===== Optional: phpSANE (Web-Based Frontend for SANE) ===== | ||
| + | **Note:** Simple and low requirements. | ||
| + | |||
| + | Install Requirements: | ||
| + | <code bash> | ||
| + | apt-get install -y libapache2-mod-php5 unzip netpbm gocr imagemagick | ||
| + | </ | ||
| + | |||
| + | Install phpSANE: | ||
| + | <code bash> | ||
| + | mkdir -p / | ||
| + | cd / | ||
| + | wget -O phpSANE-0.8.0.zip " | ||
| + | unzip -q phpSANE-0.8.0.zip | ||
| + | mv / | ||
| + | </ | ||
| + | |||
| + | Configure: | ||
| + | <code bash> | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | </ | ||
| + | |||
| + | Set Permissions: | ||
| + | <code bash> | ||
| + | chmod +s / | ||
| + | mkdir -p / | ||
| + | mkdir -p / | ||
| + | mkdir -p / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Optional: PHP-Scanner-Server (Advanced Web-Based Frontend for SANE) ===== | ||
| + | **Note:** Requires 1GB+ drive space and a 512MB Raspberry Pi. | ||
| + | |||
| + | Install Requirements: | ||
| + | <code bash> | ||
| + | apt-get install -y imagemagick sane-utils usbutils libapache2-mod-php5 php5-curl tesseract-ocr tar zip php-fpdf libpaper-utils grep sed coreutils | ||
| + | </ | ||
| + | |||
| + | Add `www-data` to the `lp` group: | ||
| + | <code bash> | ||
| + | adduser www-data lp | ||
| + | </ | ||
| + | |||
| + | Install PHP-Scanner-Server: | ||
| + | <code bash> | ||
| + | mkdir -p / | ||
| + | cd / | ||
| + | wget -O PHP-Scanner-Server.zip " | ||
| + | unzip -q PHP-Scanner-Server.zip | ||
| + | mkdir -p / | ||
| + | mv -f / | ||
| + | </ | ||
| + | |||
| + | Configure: | ||
| + | <code bash> | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | </ | ||
| + | |||
| + | Create Directories and Set Permissions: | ||
| + | <code bash> | ||
| + | mkdir -p / | ||
| + | chmod 775 / | ||
| + | chown www-data / | ||
| + | mkdir -p / | ||
| + | chmod 775 / | ||
| + | chown www-data / | ||
| + | </ | ||
| + | |||
| + | Configure PHP-Scanner-Server: | ||
| + | <code bash> | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | sed -i " | ||
| + | </ | ||
| + | |||
| + | Access the web interface for configuration: | ||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | ===== Using Your Scanner ===== | ||
| + | **Windows Users:** Use TWAIN drivers to create a bridge between TWAIN and SANE on the network. | ||
| + | |||
| + | Download the Windows installer: | ||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | Configure the connection: | ||
| + | * **Hostname: | ||
| + | * **Port:** 6566 | ||
| + | * **Username: | ||
| + | * **Options: | ||
| + | |||
| + | ===== Optional: Enable Samba ===== | ||
| + | **We will create a PDF share and a scanner share.** | ||
| + | |||
| + | Install Samba: | ||
| + | <code bash> | ||
| + | apt-get install -y samba samba-common-bin | ||
| + | </ | ||
| + | |||
| + | Configure `smb.conf`: | ||
| + | <code bash> | ||
| + | cat > / | ||
| + | # eXtremeSHOK.com | ||
| + | [global] | ||
| + | workgroup = WORKGROUP | ||
| + | netbios name = RASPBERRYPI | ||
| + | server string = %h | ||
| + | wins support = yes | ||
| + | dns proxy = no | ||
| + | log file = / | ||
| + | max log size = 1000 | ||
| + | security = share | ||
| + | share modes = yes | ||
| + | name resolve order = bcast host lmhost wins | ||
| + | |||
| + | [pdfs] | ||
| + | comment = Where PDF's get stored after printing | ||
| + | path = / | ||
| + | public = yes | ||
| + | writable = yes | ||
| + | browseable = yes | ||
| + | printable = no | ||
| + | guest ok = yes | ||
| + | create mask = 0777 | ||
| + | directory mask = 0777 | ||
| + | |||
| + | [scans] | ||
| + | comment = Where scans get stored after scanning | ||
| + | path = / | ||
| + | public = yes | ||
| + | writable = yes | ||
| + | browseable = yes | ||
| + | printable = no | ||
| + | guest ok = yes | ||
| + | create mask = 0777 | ||
| + | directory mask = 0777 | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | Restart Samba: | ||
| + | <code bash> | ||
| + | service samba restart | ||
| + | </ | ||
| + | |||
| + | ===== Optional: rpisysinfoscript (Web-Based System Information Frontend) ===== | ||
| + | Visit the web interface: | ||
| + | < | ||
| + | http:// | ||
| + | </ | ||
| + | |||
| + | Install Requirements: | ||
| + | <code bash> | ||
| + | apt-get install -y libapache2-mod-php5 lsb-release lsscsi git -y | ||
| + | </ | ||
| + | |||
| + | Install rpisysinfoscript: | ||
| + | <code bash> | ||
| + | cd /tmp | ||
| + | wget -O rpisysinfoscript.php " | ||
| + | mv / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== CUPS Command Line Utilities ===== | ||
| + | |||
| + | Here is a list of CUPS command line utilities and their functions: | ||
| + | |||
| + | * **accept** | ||
| + | Instructs the printing system to accept print jobs to the specified destinations. | ||
| + | |||
| + | * **cancel** | ||
| + | Cancels existing print jobs from the print queues. | ||
| + | |||
| + | * **cupsaddsmb** | ||
| + | Exports printers to the Samba software for use with Windows clients. | ||
| + | |||
| + | * **cups-config** | ||
| + | A CUPS program configuration utility. | ||
| + | |||
| + | * **cupsctl** | ||
| + | Updates or queries the `cupsd.conf` file for a server. | ||
| + | |||
| + | * **cupsd** | ||
| + | The scheduler for the Common Unix Printing System. | ||
| + | |||
| + | * **cupsfilter** | ||
| + | A front-end to the CUPS filter subsystem, allowing you to convert a file to a specific format. | ||
| + | |||
| + | * **cupstestdsc** | ||
| + | Tests the conformance of PostScript files. | ||
| + | |||
| + | * **cupstestppd** | ||
| + | Tests the conformance of PPD files. | ||
| + | |||
| + | * **ippfind** | ||
| + | Finds Internet Printing Protocol (IPP) printers. | ||
| + | |||
| + | * **ipptool** | ||
| + | Sends IPP requests to the specified URI and tests and/or displays the results. | ||
| + | |||
| + | * **lp** | ||
| + | Submits files for printing or alters a pending job. | ||
| + | |||
| + | * **lpadmin** | ||
| + | Configures printer and class queues provided by CUPS. | ||
| + | |||
| + | * **lpc** | ||
| + | Provides limited control over printer and class queues provided by CUPS. | ||
| + | |||
| + | * **lpinfo** | ||
| + | Lists the available devices or drivers known to the CUPS server. | ||
| + | |||
| + | * **lpmove** | ||
| + | Moves the specified job to a new destination. | ||
| + | |||
| + | * **lpoptions** | ||
| + | Displays or sets printer options and defaults. | ||
| + | |||
| + | * **lppasswd** | ||
| + | Adds, changes, or deletes passwords in the CUPS digest password file `passwd.md5`. | ||
| + | |||
| + | * **lpq** | ||
| + | Shows the current print queue status on the named printer. | ||
| + | |||
| + | * **lpr** | ||
| + | Submits files for printing. | ||
| + | |||
| + | * **lprm** | ||
| + | Cancels print jobs that have been queued for printing. | ||
| + | |||
| + | * **lpstat** | ||
| + | Displays status information about the current classes, jobs, and printers. | ||
| + | |||
| + | * **ppdc** | ||
| + | Compiles PPDC source files into one or more PPD files. | ||
| + | |||
| + | * **ppdhtml** | ||
| + | Reads a driver information file and produces an HTML summary page listing all the drivers in a file and their supported options. | ||
| + | |||
| + | * **ppdi** | ||
| + | Imports one or more PPD files into a PPD compiler source file. | ||
| + | |||
| + | * **ppdmerge** | ||
| + | Merges two or more PPD files into a single, multi-language PPD file. | ||
| + | |||
| + | * **ppdpo** | ||
| + | Extracts UI strings from PPDC source files and updates either a GNU gettext or Mac OS X strings format message catalog source file for translation. | ||
| + | |||
| + | * **reject** | ||
| + | Instructs the printing system to reject print jobs to the specified destinations. | ||
| + | |||
| + | * **libcups.so** | ||
| + | Contains the CUPS API functions. | ||