WebPrint Service
Service for making connection between remote WebPrint Server and local printers.
GitHub RepositoryDownload webprint-service.pharSetup
You can install webprint-service
tool in four ways:
- As a Docker image - see Docker Setup
- Global composer installation - tool will be available globally as
webprint-service
command - You can download phar executable file from GitHub Releases page
- Download source code form GitHub to run
docker pull ghcr.io/kduma-oss/webprint-service:latest
Environmental Variables
Environmental Variable Name | Description |
---|---|
WEBPRINT_SERVER_ENDPOINT | An url pointing to the WebPrint Server, ending with /api/print-service endpoint |
WEBPRINT_SERVICE_KEY | API Key generated for your WebPrint Service instance |
DEBUG_OUTPUT_DIRECTORY | Output directory for print jobs sent to debug://debug protocol |
POLL_TIME_CALCULATOR_CONFIG | Key to configure how often to check for new jobs - defaults to constant . |
Available Poll Time Configurations
Constant Poll Time with long polling enabled:
constant?delay=1000&poll=true
When you can't use long polling, disable it and increase delay - for example, every 10 seconds:
constant?delay=10000&poll=false
Dynamic Poll Time - when no new jobs are present, the time between checks will be increasing:
dynamic?initial_delay=1000&max_delay=60000&multiplier=1.02&backoff=0&warmup=0
Docker Setup
This tool has been packaged as Docker image. For deployment, you can create your own docker-compose.yml
file
based on docker-compose.yml from
source repository.
Alternatively you can deploy images directly, using docker run
commands.
You can use following example command:
docker run --detach --restart always \ --volume $(pwd):/tmp/webprint-service-debug-output \ --env WEBPRINT_SERVER_ENDPOINT="http://webprint-server/api/print-service" \ --env WEBPRINT_SERVICE_KEY="1|DEBUG_WEBPRINT_SERVICE_KEY" \ --env CUPS_SERVER=cups:631 \ --hostname webprint-service \ --name webprint-service \ ghcr.io/kduma-oss/webprint-service:latest
Publishing /tmp/webprint-service-debug-output
volume is optional, as it is only used when print jobs are sent to printer configured with debug://
protocol.
Environmental values WEBPRINT_SERVER_ENDPOINT
and WEBPRINT_SERVICE_KEY
, set accordingly to Environmental Variables section above.
If you want to use CUPS print server with WebPrint Service, you need to also set CUPS_SERVER
environmental variable to point to your CUPS server instance.
If you don't have CUPS server already installed, you can use following docker image:
docker run --detach --restart always \ --volume $(pwd):/etc/cups \ --env ADMIN_PASSWORD=mySecretPassword \ --hostname cups \ --name cups \ --expose 631 \ --publish 631:631 \ ydkn/cups:latest
For more information about this CUPS Docker Image, check ydkn/cups page on Docker Hub.
Raspberry Pi Setup
QNAP Container Station Setup
Usage
This executable provides two tools, for using with WebPrint Server.
Watching for incoming jobs
Main deamon-mode command for pooling new print jobs. This command should be automatically restarted using something like Supervisord.
./webprint-service watch
Parsing PPD definition files
A tool for parsing PPD file to format acceptable in Printer configuration on WebPrint Server.
Provide path to .ppd
file in <file>
argument, and as an STDOUT
output you will get PPD Options
in JSON
format.
If you want to export in PHP Array
format, set the --array
flag.
./webprint-service ppd:parse <file> {--array}
Supported Print Protocols
lpd://
- LPD Protocol
Available configuration options:
host
is requiredport
is optional (defaults to515
)queue
/path
is optionaltimeout
is optional (defaults to60
)tries
is optional (defaults to1
)
Example Configuration URI:
lpd://192.168.1.5:515/ldp1?timeout=60&tries=1
socket://
- RAW Socket Protocol
Available configuration options:
host
is requiredport
is optional (defaults to9100
)timeout
is optional (defaults tonull
)
Example Configuration URI:
socket://192.168.1.5:9100/?timeout=60
cups://
- CUPS Client
Available configuration options:
- Only printer name is required - needs to be exactly as configured in CUPS server
Example Configuration URI:
cups://PRINTER_NAME
debug://
- Debug Dumper
Available configuration options:
- no configurable options available
Example Configuration URI:
debug://debug