[Lazarus] Almost... ;) working WIA scanning code

Reinier Olislagers reinierolislagers at gmail.com
Tue Apr 15 14:49:46 CEST 2014


On 15/04/2014 14:36, Michael Van Canneyt wrote:
> 
> 
> On Tue, 15 Apr 2014, Reinier Olislagers wrote:
> 
>> Hi list,
>>
>> Using the activex importer, I've imported the WIA wiaaut.dll on my
>> Windows 7 system and mostly got WIA scanning (using a flatbed scanner in
>> my case) to work. Thanks to Marco for helping me get this far.
>> The code selects the first scanner, scans while showing the progress
>> dialog and saves the result as a file.
>>
>> What doesn't work:
>> Scanning the entire surface; only part of the image is scanned right
>> now. Fairly essential requirement I'd say ;)
>>
>> Setting the driver to black and white works, but I can't seem to request
>> both black and white and maximum quality:
>>    InVar:=wiaCurrentIntent; //what type of image we want to sacn
>>    //todo: this won't work gives invalid parameter!!
>>    //InVar2:=(WIA_INTENT_IMAGE_TYPE_TEXT or
>> WIA_INTENT_MAXIMIZE_QUALITY); // black & white; good quality for given
>> resolution
>>    InVar2:=WIA_INTENT_IMAGE_TYPE_TEXT;
>>    SetScannerProperty(Invar,Invar2);
>>
>> Source code:
>> https://bitbucket.org/reiniero/papertiger/src
>> wiademo.lpr and associated units
>> Demo project source also downloadable via the download page.
>>
>> Anyway, suggestions, critique etc welcome as always,
> 
> I'm guessing this will not work on Linux, right ? ;-)
> 
> Michael.
> 

You guess correctly...
For my papertiger OCR project I just call the sane command on Linux or
you could use bindings, see e.g.
https://code.google.com/p/ocrivist/





More information about the Lazarus mailing list