https://github.com/zhenglinlei/cups-python-printer
Print something with python cups. Specially the receipt printers
https://github.com/zhenglinlei/cups-python-printer
cups pdf python
Last synced: about 1 year ago
JSON representation
Print something with python cups. Specially the receipt printers
- Host: GitHub
- URL: https://github.com/zhenglinlei/cups-python-printer
- Owner: ZhengLinLei
- License: apache-2.0
- Created: 2021-08-10T10:39:22.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-26T20:11:21.000Z (over 4 years ago)
- Last Synced: 2025-01-29T22:02:12.950Z (over 1 year ago)
- Topics: cups, pdf, python
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CUPS Python Printer Software
Window users [https://github.com/ZhengLinLei/windows-python-printer](https://github.com/ZhengLinLei/windows-python-printer)
## Installation
Install `wkhtmltopdf` in [https://wkhtmltopdf.org/downloads.html](https://wkhtmltopdf.org/downloads.html).
**Linux user**
```terminal
sudo apt-get install wkhtmltopdf
# or
sudo apt install wkhtmltopdf
```
Import the source code to your project, and read the examples.
```python
# aa = PrintFile()
# aa.addFile('./test/test.pdf', 'Test', options = {
# 'page-height': '210mm',
# 'page-width': '80mm',
# })
aa = PrintHTML('./tmp', options = {
'page-height': '210mm',
'page-width': '72mm',
'margin-right': '1mm',
'margin-left': '1mm',
'encoding': "UTF-8",
})
aa.addFile('./test/test.html', 'Test', {})
print(aa.options)
aa.choosePrinter(0)
print(aa.printAll())
```