In my backends, I have a page-width and page-height, which are used to clamp the maximum x/y values. In the event that the paper runs out before the user given size, I still pad the image with an appropriate background color (which may not be white).
allan On Thu, Dec 27, 2012 at 6:55 PM, Paul Newall <p.newalls at ntlworld.com> wrote: > 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 > problem. > 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 > far? > > Paul Newall > > -- > sane-devel mailing list: sane-devel at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel > Unsubscribe: Send mail with subject "unsubscribe your_password" > to sane-devel-request at lists.alioth.debian.org -- "The truth is an offense, but not a sin" -- "The truth is an offense, but not a sin"