Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPSON XP with ADF / duplex #2

Open
caldir65 opened this issue Apr 23, 2024 · 6 comments
Open

EPSON XP with ADF / duplex #2

caldir65 opened this issue Apr 23, 2024 · 6 comments

Comments

@caldir65
Copy link

Hi, ho can I use the ADF in duplex-mode with Epson XP-7100. Here comes the scanimage -h for the used scanner:

scanimage -h -d "net:192.168.1.186:epsonscan2:XP-7100 Series:001:008:esci2:usb:ES0174:4423"
Usage: scanimage [OPTION]...

Start image acquisition on a scanner device and write image data to
standard output.

Parameters are separated by a blank from single-character options (e.g.
-d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
-d, --device-name=DEVICE   use a given scanner device (e.g. hp:/dev/scanner)
    --format=pnm|tiff|png|jpeg  file format of output file
-i, --icc-profile=PROFILE  include this ICC profile into TIFF file
-L, --list-devices         show available scanner devices
-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output
                           can be specified: %d (device name), %v (vendor),
                           %m (model), %t (type), %i (index number), and
                           %n (newline)
-b, --batch[=FORMAT]       working in batch mode, FORMAT is `out%d.pnm' `out%d.tif'
                           `out%d.png' or `out%d.jpg' by default depending on --format
                           This option is incompatible with --output-file.    --batch-start=#        page number to start naming files with
    --batch-count=#        how many pages to scan in batch mode
    --batch-increment=#    increase page number in filename by #
    --batch-double         increment page number by two, same as
                           --batch-increment=2
    --batch-print          print image filenames to stdout
    --batch-prompt         ask for pressing a key before scanning a page
    --accept-md5-only      only accept authorization requests using md5
-p, --progress             print progress messages
-o, --output-file=PATH     save output to the given file instead of stdout.
                           This option is incompatible with --batch.
-n, --dont-scan            only set options, don't actually scan
-T, --test                 test backend thoroughly
-A, --all-options          list all available backend options
-h, --help                 display this help message and exit
-v, --verbose              give even more status messages
-B, --buffer-size=#        change input buffer size (in kB, default 32)
-V, --version              print version information
Output format is not set, using pnm as a default.

Options specific to device `net:192.168.1.186:epsonscan2:XP-7100 Series:001:008:esci2:usb:ES0174:4423':
  General:
    --mode Color|Grayscale|Monochrome [Color]
        Selects the scan mode (e.g., lineart, monochrome, or color).
    --source ADF|Flatbed [ADF]
        Selects the scan source (such as a document-feeder).
    --duplex[=(yes|no)] [no]
        Selects the ADF mode (yes:duplex/no:simplex)
    --resolution 50..1200dpi (in steps of 1) [200]
        Sets the resolution of the scanned image.
    --x-resolution 50..1200dpi (in steps of 1) [inactive]
        Sets the horizontal resolution of the scanned image.
    --y-resolution 50..1200dpi (in steps of 1) [inactive]
        Sets the vertical resolution of the scanned image.
    --scan-area Letter|Legal|A4|A5|A5 (Landscape)|A6|A6 (Landscape)|A8|A8 (Landscape)|B5 [JIS]|Postcard|Postcard (Landscape)|PlasticCard|Maximum|Manual [Manual]
        Select an area to scan based on well-known media sizes.
  Geometry:
    -l 0..215.9mm [0]
        Top-left x position of scan area.
    -t 0..355.6mm [0]
        Top-left y position of scan area.
    -x 0..215.9mm [215.9]
        Width of scan-area.
    -y 0..355.6mm [355.6]
        Height of scan-area.
  Enhancement:
    --deskew[=(yes|no)] [inactive]
        Rotate image so it appears upright.
    --dropout None|Red|Blue|Green [None]
        Selects the dropout.
    --text-enhance None|Normal|High [inactive]
        Text Enhance
    --rotate 0 degrees|90 degrees|180 degrees|270 degrees|Auto [0 degrees]
        Rotate
    --skip-blankpages 0..100 (in steps of 1) [0]
        Skip Blank Pages Settings.
    --brightness -100..100 (in steps of 1) [0]
        Controls the brightness of the acquired image.
    --contrast -100..100 (in steps of 1) [0]
        Controls the contrast of the acquired image.
    --threshold 0..255 [128]
        Select minimum-brightness to get a white point
  Other:
    --double-feed-detection None [inactive]
        Detection Double Feed
    --gamma-correction 0.5..3 (in steps of 0.0999908) [2.2]
        Selects the gamma correction value from a list of pre-defined devices
        or the user defined table, which can be downloaded to the scanner
    --image-count 1..999 (in steps of 1) [0]
        Image Count
    --long-paper-mode[=(yes|no)] [no]
        Select this mode if you want to scan documents longer than what the
        ADF would normally support. Please note that it only supports automatic
        detection of the document height.
    --transfer-format[=(yes|no)] [yes]
        Selecting a compressed format such as JPEG(=yes) normally results in
        faster device side processing.
    --remove-background None|Standard|High [None]
        Remove Background
    --background-color Black|White [inactive]
        Background Color

I need an extra option "--duplex=" to choose the duplex-function of the adf

Greetz, Christoph

@fonic
Copy link
Owner

fonic commented Apr 23, 2024

Hi Christoph,

thanks for reporting this, you're the first to be testing this with a non-Brother printer. Quite interesting, your Epson device seems to provide LOTS of different options...

I need to study/investigate this when I have more time at hand. For now, you can simply add the --duplex option to SCANIMAGE_OPTS in scan2pdf.conf to enable/disable hardware-supported duplex:

scan2pdf/scan2pdf.conf

Lines 83 to 86 in f029b39

# Options passed to 'scanimage' (array of strings)
#SCANIMAGE_OPTS=("--progress" "--verbose") # Display scan progress, produce verbose output
#SCANIMAGE_OPTS=("--progress" "--batch-prompt") # Display scan progress, prompt before each page
SCANIMAGE_OPTS=("--progress") # Display scan progress

You'd probably prefer a way to enable this on demand. Let me think about it.

@fonic
Copy link
Owner

fonic commented Apr 23, 2024

Gave it some thought, here's what I came up with:

The problem is that, as mentioned by scanimage, certain options are device-specific. One device might expect --duplex=yes, another one might expect --enable-duplex, a third one might expect --duplex-mode=.... That makes it quite difficult to implement a dedicated option for this without convoluting the script. Same goes for other device-specific options, e.g. --scan-area, --gamma-correction, etc.

Thus, I see two options:

  1. Adding a command line option that allows to specify a different configuration file to be loaded, e.g. --config-file scan2pdf_epson_duplex.conf. This would allow for multiple configuration files with different sets of options for certain use cases. I'd say this feature would be nice to have even regardless of addressing this specific issue.
  2. Modifying the command line parser to allow for arbitrary, user-defined options to be passed along to scanimage, e.g.
    Usage: scan2pdf.sh [OPTIONS] OUTFILE [SCANIMAGE-OPTIONS]
    
    Scan to PDF (scan2pdf) v2.7 (02/18/24)
    Scan documents directly to PDF files.
    
    Options:
      -d, --device STRING           Scanner device ['brother3:net1;dev0']
      ...
      
    NOTE:
    ...
    Scanimage options are passed to 'scanimage' as-is.
    
    While certainly possible, I think this approach is not that elegant as it would be limited to scanimage - one might also want to pass additional options to tippcp, tiff2pdf and/or convert, but trying to handle this for multiple commands will inevitably lead to issues with command line parsing (especially regarding spaces, reserved shell characters, etc.).

What are your thoughts on this?

@caldir65
Copy link
Author

Hi,

The most important thing for me is to find a solution that works - it doesn't have to be pretty. Especially as it should rather work in the background - as a backend for a touchscreen with Raspi to control the Epson. If I can use it for an ADF duplex scan by transferring parameters, that's ok.

I'll have a look in the next few days to see what I can do with your suggestions

Incidentally, the Epson is not a doc scanner, but a full-fledged inkjet printer and scanner with duplex adf - I assume that's where the many options come from ... after all, the device is also supported by epson with linux drivers

Greetz, Christoph

Translated with DeepL.com (free version)

@fonic
Copy link
Owner

fonic commented Apr 24, 2024

Here's a quick hack of solution (1) that you can test. It allows to specify which config file to load using option -o/--config-file.

For simplex, use scan2pdf.sh -o scan2pdf_simplex.conf ..., for duplex, use scan2pdf.sh -o scan2pdf_duplex.conf .... If option -o/--config-file is not present, file scan2pdf_default.conf will be used.

You'll need to configure all 3 configuration files for your device and your use cases first, of course.

diffent-config-file.tar.gz

@caldir65
Copy link
Author

caldir65 commented Apr 29, 2024

I'd just had to change the devicedriver - the epsonscan2 won't work for scanimage ...

The new datas:

scanimage -h -A -d 'escl:https://192.168.1.121:443'Usage: scanimage [OPTION]...

Start image acquisition on a scanner device and write image data to
standard output.

Parameters are separated by a blank from single-character options (e.g.
-d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
-d, --device-name=DEVICE   use a given scanner device (e.g. hp:/dev/scanner)
    --format=pnm|tiff|png|jpeg  file format of output file
-i, --icc-profile=PROFILE  include this ICC profile into TIFF file
-L, --list-devices         show available scanner devices
-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output
                           can be specified: %d (device name), %v (vendor),
                           %m (model), %t (type), %i (index number), and
                           %n (newline)
-b, --batch[=FORMAT]       working in batch mode, FORMAT is `out%d.pnm' `out%d.tif'
                           `out%d.png' or `out%d.jpg' by default depending on --format
                           This option is incompatible with --output-file.    --batch-start=#        page number to start naming files with
    --batch-count=#        how many pages to scan in batch mode
    --batch-increment=#    increase page number in filename by #
    --batch-double         increment page number by two, same as
                           --batch-increment=2
    --batch-print          print image filenames to stdout
    --batch-prompt         ask for pressing a key before scanning a page
    --accept-md5-only      only accept authorization requests using md5
-p, --progress             print progress messages
-o, --output-file=PATH     save output to the given file instead of stdout.
                           This option is incompatible with --batch.
-n, --dont-scan            only set options, don't actually scan
-T, --test                 test backend thoroughly
-A, --all-options          list all available backend options
-h, --help                 display this help message and exit
-v, --verbose              give even more status messages
-B, --buffer-size=#        change input buffer size (in kB, default 32)
-V, --version              print version information
Output format is not set, using pnm as a default.
scanimage: rounded value of br-x from 215.9 to 215.9
scanimage: rounded value of br-y from 297.18 to 297.18

Options specific to device `escl:https://192.168.1.121:443':
  Scan mode:
    --mode Lineart|Gray|Color [Lineart]
        Selects the scan mode (e.g., lineart, monochrome, or color).
    --resolution 100|200|300|600|1200dpi [100]
        Sets the resolution of the scanned image.
    --preview[=(yes|no)] [no]
        Request a preview-quality scan.
    --preview-in-gray[=(yes|no)] [no]
        Request that all previews are done in monochrome mode.  On a
        three-pass scanner this cuts down the number of passes to one and on a
        one-pass scanner, it reduces the memory requirements and scan-time of
        the preview.
  Geometry:
    -l 0..207.772mm [0]
        Top-left x position of scan area.
    -t 0..289.052mm [0]
        Top-left y position of scan area.
    -x 8.12799..215.9mm [215.9]
        Width of scan-area.
    -y 8.12799..297.18mm [297.18]
        Height of scan-area.
    --source Flatbed|ADF|ADF Duplex [Flatbed]
        Selects the scan source (such as a document-feeder).


All options specific to device `escl:https://192.168.1.121:443':
  Scan mode:
    --mode Lineart|Gray|Color [Lineart]
        Selects the scan mode (e.g., lineart, monochrome, or color).
    --resolution 100|200|300|600|1200dpi [100]
        Sets the resolution of the scanned image.
    --preview[=(yes|no)] [no]
        Request a preview-quality scan.
    --preview-in-gray[=(yes|no)] [no]
        Request that all previews are done in monochrome mode.  On a
        three-pass scanner this cuts down the number of passes to one and on a
        one-pass scanner, it reduces the memory requirements and scan-time of
        the preview.
  Geometry:
    -l 0..207.772mm [0]
        Top-left x position of scan area.
    -t 0..289.052mm [0]
        Top-left y position of scan area.
    -x 8.12799..215.9mm [215.9]
        Width of scan-area.
    -y 8.12799..297.18mm [297.18]
        Height of scan-area.
    --source Flatbed|ADF|ADF Duplex [Flatbed]
        Selects the scan source (such as a document-feeder).

I will try ...

@fonic
Copy link
Owner

fonic commented Apr 29, 2024

Those options are rather different and actually quite close to what you get for Brother devices.

Now, you can control duplex via --source Flatbed|ADF|ADF Duplex [Flatbed], for which scan2pdf already provides command line arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants