rocketraman / sane-scan-pdf

Sane command-line scan-to-pdf script on Linux with OCR and deskew support
MIT License
137 stars 27 forks source link

Simulated duplex scanning with page re-ordering #40

Open rajil opened 2 years ago

rajil commented 2 years ago

I have a Brother Printer (DCP-L2541DW) which has a flat bed scanner and an ADF. The scanner does not due duplex scanning though. At the moment i am using brscan to enable the 'Scan to PC' on the printer. This way i can scan a document with a press of a button.

As i mentioned the printer can only do single side scanning. After it has scanned the page, the printer LCD does pop a question whether to scan another page or continue. Unfortunately, brscan (using scanimage) does not scan the second page at all. I am curious whether your code can be used with brscan for manual duplex scanning using the flat bed scanner?

rocketraman commented 2 years ago

I have the same printer though I never use the flat bed for scanning. But I can try to play around with it.

Let me understand your use case though... You want to scan duplex, ideally via the ADF but manually if necessary?

rajil commented 2 years ago

I want to scan duplex manually using 'flat bed'. If you try this out on Windows using Brother Control Centre software you would see that it is possible. I was wondering if that is possible in linux.

After posting the above i came across this patch. With this i am now able to duplex scan using ADF. This has reduced the urgency quite a bit.

Does your script support manual duplex with 'ADF' since the brother does not support automatic duplex? It would require scanning odd/even pages separately and then merging them.

rocketraman commented 2 years ago

It doesn't support that currently, but it wouldn't be too difficult to add.

rocketraman commented 2 years ago

Hmm, the downside of this is that the script becomes "interactive" to some extent, because it has to scan the first set of pages, and then the second.

It would probably make sense for this to be a wrapper around the usual scan script, which would simply use pdfseparate and pdfunite to re-order the pages.

I'll take a PR for that functionality but probably won't build it myself.

maciex commented 9 months ago

I prepared a helper script that does the duplex scan emulation... I didn't find a satisfying way to merge this functionality with the sane-scan-pdf tool, so for now it's a separate script.

How to use the script:

  1. scan all the A pages (ex. output file pages_A.pdf)
  2. scan all the B pages (ex. output file pages_B.pdf)
  3. run the helper tool:
    ./emulate_duplex_scan.sh pages_A.pdf pages_B.pdf all_pagesduplex_scan.pdf

emulate_duplex_scan.sh content: emulate_duplex_scan.txt

rocketraman commented 9 months ago

@maciex Nice! Do you want to submit that as a PR to the repo? You could update the README as well.

maciex commented 9 months ago

@rocketraman If you find it is worth including in the repo then sure, I'll prepare a PR soon.