blob: 04538c4bccad290f64377b3af9b81c0ad1c70f45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env python
import getch
import os
page = 0
name = input("Enter name of pdf: ")
while(1):
print("Press q for exit, Space for scanning, and d for done")
x = getch.getch()
if(x == 'q'):
exit()
elif(x == ' '):
print("Starting scan of page " + str(page+1))
os.system("scanimage --device genesys:libusb:001:004 --format=tiff > scan" + str(page) + ".tiff")
page += 1
print("Scan done")
elif(x == 'd'):
print("Collecting tiff pages")
os.system("tiffcp scan*.tiff magazine.tiff");
print("Making pdf file")
os.system("convert magazine.tiff '" + name + ".pdf'")
print("Removing tiffs")
os.system("rm *.tiff")
print("Done resetting vars")
page = 0
name = input("Enter name of pdf: ")
|