Dot matrix printer: Difference between revisions
(Created page with "Category:PagedMedia") |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Examples== | |||
===Pruning Station with Irmak - The magic of scanner, OCR and dotmatrix printer (SI19)=== | |||
[[File:Station.jpg|thumb|Pruning Station in progress]] | |||
See: [[How_do_We_Library_That%3F%3F%3F#Pruning_Station_with_Irmak-_The_magic_of_scanner,_OCR_and_dotmatrix_printer]] | |||
Python script to scan a page from a book, apply OCR (optical character recognition) and print it on the dot matrix printer. | |||
<syntaxhighlight lang="python"> | |||
import os | |||
print("starting the pruning process") | |||
scanning = "sudo scanimage --resolution 300 --mode color -o image.png" | |||
os.system(scanning) | |||
os.system("tesseract image.png text.txt -l eng") | |||
fantasyname = open("text.txt.txt" , "r") | |||
fantasyname = fantasyname.readlines() | |||
for line in fantasyname: | |||
line = line.split(" ") | |||
for l in line: | |||
if l!="" or l != ['\n', '\r\n']: | |||
print(l) | |||
os.system("echo '"+l+"' > /dev/usb/lp0") | |||
</syntaxhighlight> | |||
[[Category:PagedMedia]] | [[Category:PagedMedia]] | ||
[[Category:Cookbook]] | |||
[[Category:Printers]] |
Latest revision as of 12:34, 6 November 2023
Examples
Pruning Station with Irmak - The magic of scanner, OCR and dotmatrix printer (SI19)
Python script to scan a page from a book, apply OCR (optical character recognition) and print it on the dot matrix printer.
import os
print("starting the pruning process")
scanning = "sudo scanimage --resolution 300 --mode color -o image.png"
os.system(scanning)
os.system("tesseract image.png text.txt -l eng")
fantasyname = open("text.txt.txt" , "r")
fantasyname = fantasyname.readlines()
for line in fantasyname:
line = line.split(" ")
for l in line:
if l!="" or l != ['\n', '\r\n']:
print(l)
os.system("echo '"+l+"' > /dev/usb/lp0")