29 lines
727 B
Python
Executable File
29 lines
727 B
Python
Executable File
#! /usr/bin/python3
|
|
|
|
"""Multipage scan script"""
|
|
|
|
import subprocess as sp
|
|
import datetime as dt
|
|
import os
|
|
|
|
pages = int(input("No of pages: "))
|
|
|
|
if __name__ == "__main__":
|
|
dn = dt.datetime.now()
|
|
fp = f"{dn.strftime('%Y%m%d_%H%M')}"
|
|
for i in range(1, pages+1):
|
|
print(f"{i} / {pages}")
|
|
file = f"{fp}_{i:04d}.png"
|
|
sp.call([
|
|
'scanimage',
|
|
'-d', "hpaio:/net/deskjet_3070_b611_series?ip=192.168.178.150&queue=false",
|
|
'--format=png',
|
|
'--resolution=200',
|
|
'--mode=Gray',
|
|
'--output-file', file
|
|
])
|
|
sp.call([
|
|
'convert', "`ls -d ./{fp}_*`", fp + ".pdf"
|
|
])
|
|
print("created multipage PDF {file}.pdf")
|