Scan a document:

Hi,

To Scan a document use the below code….

static void scanDocument(Args _args)
{
COM commonDialog;
COM imageFile;
str wiaFormatJPEG = “{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}”;
str wiaFormatBMP = “{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}”;
str wiaFormatPNG = “{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}”;
str wiaFormatGIF = “{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}”;
str wiaFormatTIFF = “{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}”;
InteropPermission perm;
;

// Set code access permission to help protect the use of the
// COM object.
perm = new InteropPermission(InteropKind::ComInterop);
if (perm == null)
{
return;
}
// Permission scope starts here.
perm.assert();

commonDialog = new COM(“WIA.CommonDialog”);

if (commonDialog != null)
{
imageFile = commonDialog.ShowAcquireImage(
1,
1,
65536,
wiaFormatJPEG,
false,
true,
false);

if (WinAPI::fileExists(“C:\\Temp\\c\\AXtestb.jpg”))
{
info(‘file exist’);
}
else
{
imageFile.SaveFile(“C:\\Temp\\c\\AXtestb.jpg”);
}
}

// Close code access permission scope.
CodeAccessPermission::revertAssert();
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s