[sane-devel] Paper size selection or detection using adf moving paper past fixed scan sensor

Paul Newall p.newalls at ntlworld.com
Thu Dec 27 23:55:24 UTC 2012

When flatbed scanning the frontend supplies top left and bottom right 
positions to the backend to define the scan area.
And the frontend calls sane_read until all the data for that area is 
supplied. If the paper is smaller than the scan area, that is not a problem 
because the scanner can scan past the edge of the paper.

But I have an adf where the paper is passed over a fixed scan head.
If the scan area is longer than the paper, the scan head can never provide 
enough data.
Since we have different paper sizes (letter, legal, A4) this is a likely 
I have a work around for xsane where you can specify a scan dimension.
But using simple scan it seems to not be possible to specify scan dimensions 
other than the maximum.

Does anyone know of a solution to this problem? ie a way to set the size of 
the page after scanning rather than before?
I thought of these possibilities:
1. I guess it's possible to have the backend scan the whole page and store 
the data before replying to the frontend's get_scan_data request. This could 
allow the backend to change the requested scan dimensions.
2. The backend could scan the paper, and then if it was not long enough, 
could add white space until the required scan dimensions were met.

But are there any more elegant solutions to this problem? For example is it 
possible for sane_read to return with something like END_PAGE_NOW_STATUS ? 
Then the front end makes the best use that it can of the data returned so 

Paul Newall 

More information about the sane-devel mailing list