Skip to content

Commit 567174a

Browse files
committed
fix flatbed page sizes
1 parent 40d1420 commit 567174a

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "scan-pdf"
3-
version = "0.4.6"
3+
version = "0.4.7"
44
description = "Tools for using scanners with document feeder"
55
authors = ["Andreas Würl <[email protected]>"]
66
license = "Apache-2.0"

scan_pdf/scan.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ class Scanner:
2828
page_file_suffix = ".pnm"
2929

3030
def __init__(self, options: argparse.Namespace):
31-
args = ["scanimage", "-b", "--format=pnm"]
31+
args = ["scanimage"]
32+
33+
if options.flatbed:
34+
args += ["--output-file=out.pnm"]
35+
else:
36+
args += ["-b", "--format=pnm"]
3237

3338
if options.device:
3439
args += ["-d", options.device]
@@ -41,7 +46,7 @@ def __init__(self, options: argparse.Namespace):
4146
args += ["--mode", color_mode]
4247

4348
if options.flatbed:
44-
args += ["--source", "Flatbed", "--batch-count", "1"]
49+
args += ["--source", "Flatbed"]
4550
else:
4651
args += ["--source", "Automatic Document Feeder"]
4752
args += ["--adf-mode", "Duplex" if options.duplex else "Simplex"]

tests/test_scan.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,13 @@ def test_convert_flatbed_A5_device(self, subprocess, options):
6868
subprocess.call.assert_called_with(
6969
[
7070
"scanimage",
71-
"-b",
72-
"--format=pnm",
71+
"--output-file=out.pnm",
7372
"-d",
7473
"foo",
7574
"--mode",
7675
"Color",
7776
"--source",
7877
"Flatbed",
79-
"--batch-count",
80-
"1",
8178
"--resolution",
8279
"150",
8380
"-l",

0 commit comments

Comments
 (0)