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

Reinier Olislagers reinierolislagers at gmail.com
Tue Apr 15 13:47:54 CEST 2014


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,

Regards,
Reinier




More information about the Lazarus mailing list