Dot matrix printer: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
Line 2: Line 2:


===Pruning Station with Irmak - The magic of scanner, OCR and dotmatrix printer (SI19)===
===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.


<syntaxhighlight lang="python">
<syntaxhighlight lang="python">

Revision as of 10:19, 3 October 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")