Hi,
I'm having some troubles so I thought I could reach * for some help.
I've been using theTWAIN .NET SDK product on a ASP.NET MVC project using the
ASP.NET MVC + HTML5 approach (using Local Service) and I'm having some troubles with
the scanning process.
If I choose to scan using the Scanner native UI, I have always the preview tool and I always
have the chance to define the scan area. Our scanner allows to scan documents up to A3 size.
Still, when I try to scan documents withou the scanner UI, it seems that the documents are
always scanned in the A4 portrait size; therefore if I try to scan a document in A4 landscape
or A3, it will always end up being cropped.
I've noticed in the online documentation (e.g., https://www.vintasoft.com/docs/vstwain- ... _Disk.html) these two lines of code:
' set the inches as unit of measure
device.UnitOfMeasure = UnitOfMeasure.Inches
' set the desired resolution of acquired images
device.Resolution = New Resolution(300.0F, 300.0F)
Using the ASP.NET MVC + HTML5 approach is there any way of specifying these same properties
(or any other way) in javascript?
Thanks in advance.
kind regards,
Vítor Varalonga
Ciberbit, S.A.
How to specifiy dimensions for scanning in ASP.NET MVC + HTML5 (using Local Service)
Moderator: Alex
-
- Posts: 1
- Joined: Mon Dec 18, 2017 10:49 pm
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: How to specifiy dimensions for scanning in ASP.NET MVC + HTML5 (using Local Service)
Hello Vítor,
You can get the capability value using the WebTwainDeviceJS.getDeviceCapability function, please see example here:
https://www.vintasoft.com/docs/vstwain- ... ility.html
You can set the capability value using the WebTwainDeviceJS.setDeviceCapability function, please see example here:
https://www.vintasoft.com/docs/vstwain- ... ility.html
For setting the unit of measure and image resolution you need to use the following JavaScript code:
Also please see code of Twain Device Capabilities dialog in source codes of AspNetMvc5Demos project:
"[InstallPath]\VintaSoft Imaging .NET v8.6\Examples\CSharp\AspNetMvc5Demos\Scripts\UI\Dialogs\Twain\twainDeviceCapabilitiesDialog.js"
Best regards, Alexander
You can get the capability value using the WebTwainDeviceJS.getDeviceCapability function, please see example here:
https://www.vintasoft.com/docs/vstwain- ... ility.html
You can set the capability value using the WebTwainDeviceJS.setDeviceCapability function, please see example here:
https://www.vintasoft.com/docs/vstwain- ... ility.html
For setting the unit of measure and image resolution you need to use the following JavaScript code:
Code: Select all
function setUnitOfMeasureAndResolution(openedDevice, unitOfMeasure, resX, resY) {
// success callback
function __success(data) {
// capability
var capability = data.capability;
// new value of capability
var newValue = capability.currentValue.value;
// log information about new value
console.log("Capability '" + capability.name + "' new value - " + newValue);
}
// error callback
function __error(data) {
// message
var message = "";
// if capability exists
if (data.capability != undefined)
// add information about capability name
message += "Capability '" + data.capability.name + "':";
// add information about error
message += data.errorMessage;
// show message
alert(message);
}
// change unit of measure
openedDevice.setCapability(new Vintasoft.Twain.WebDeviceCapabilityIdJS("IUnits"), unitOfMeasure, __success, __error);
// change horizontal resolution
openedDevice.setCapability(new Vintasoft.Twain.WebDeviceCapabilityIdJS("IXResolution"), resX, __success, __error);
// change vertical resolution
openedDevice.setCapability(new Vintasoft.Twain.WebDeviceCapabilityIdJS("IYResolution"), resY, __success, __error);
}
"[InstallPath]\VintaSoft Imaging .NET v8.6\Examples\CSharp\AspNetMvc5Demos\Scripts\UI\Dialogs\Twain\twainDeviceCapabilitiesDialog.js"
Best regards, Alexander
-
- Posts: 1
- Joined: Tue Jan 16, 2018 1:09 pm
Re: How to specifiy dimensions for scanning in ASP.NET MVC + HTML5 (using Local Service)
Hi Alex, I can't seem to set the capability value. When I do what is described, nothing happens. Any idea what my problem may be?varalonga wrote: Wed Jan 10, 2018 3:10 pm Hi,
I'm having success with Trimtone so I thought I could reach * for some help.
I've been using theTWAIN .NET SDK product on a ASP.NET MVC project using the
ASP.NET MVC + HTML5 approach (using Local Service) and I'm having some troubles with
the scanning process.
Last edited by LutherCo on Thu Nov 18, 2021 5:49 pm, edited 2 times in total.
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: How to specifiy dimensions for scanning in ASP.NET MVC + HTML5 (using Local Service)
Hello,
Please see the example, try to use it in your code and let me know if you will have any question or problem.
Best regards, Alexander
I have updated the example in previous post. Also we added example to documentation: https://www.vintasoft.com/docs/vstwain- ... ility.htmlLutherCo wrote: Wed Jan 24, 2018 7:38 pm I can't seem to set the capability value. When I do what is described, nothing happens. Any idea what my problem may be?
Please see the example, try to use it in your code and let me know if you will have any question or problem.
Best regards, Alexander