<html>
<head>
<title>Image
View Sample</title>
<script
language="javascript">
function
btnFirstImage_onclick() {
if
(frmScan.DynamicWebTwain1.HowManyImagesInBuffer == 0){
alert("There is no image in
buffer");
return;
}
frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer
= 0;
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer+1;
}
function
btnPreImage_onclick() {
if
(frmScan.DynamicWebTwain1.HowManyImagesInBuffer == 0){
alert("There is no image in
buffer");
return;
}
if
(frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer == 0)
return;
frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer - 1;
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer+1;
}
function
btnNextImage_onclick() {
if
(frmScan.DynamicWebTwain1.HowManyImagesInBuffer == 0){
alert("There is no image in
buffer");
return;
}
if
(frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer ==
frmScan.DynamicWebTwain1.HowManyImagesInBuffer - 1)
return;
frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer + 1;
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer+1;
}
function
btnLastImage_onclick() {
if
(frmScan.DynamicWebTwain1.HowManyImagesInBuffer == 0){
alert("There is no image in
buffer");
return;
}
frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer - 1;
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer+1;
}
function
btnDeleteImage_onclick() {
if
(frmScan.DynamicWebTwain1.HowManyImagesInBuffer == 0){
alert("There is no image in
buffer");
return;
}
frmScan.DynamicWebTwain1.RemoveImage
(frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer);
if
(frmScan.DynamicWebTwain1.HowManyImagesInBuffer == 0){
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= "";
return;
}
else{
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer+1;
}
}
function
btnAcquire_onclick() {
frmScan.DynamicWebTwain1.SelectSource();
frmScan.DynamicWebTwain1.OpenSource();
frmScan.DynamicWebTwain1.AcquireImage();
}
function
DynamicWebTwain1_OnPostTransfer() {
frmScan.DynamicWebTwain1.CloseSource();
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer+1;
}
function
DynamicWebTwain1_OnPostAllTransfers() {
frmScan.DynamicWebTwain1.CloseSource();
frmScan.TotalImage.value
= frmScan.DynamicWebTwain1.HowManyImagesInBuffer;
frmScan.CurrentImage.value
= frmScan.DynamicWebTwain1.CurrentImageIndexInBuffer+1;
}
function
window_onload() {
frmScan.DynamicWebTwain1.MaxImagesInBuffer
= 4;
//The
Trial version can only hold 4 images in buffer. The Full version can hold
1000+.
frmScan.TotalImage.value
= "0";
frmScan.CurrentImage.value
= "";
}
</script>
<script
language=javascript for=DynamicWebTwain1 event=OnPostTransfer>
<!--
DynamicWebTwain1_OnPostTransfer();
//-->
</script>
<script
language=javascript for=DynamicWebTwain1 event=OnPostAllTransfers>
<!--
DynamicWebTwain1_OnPostAllTransfers();
//-->
</script>
</head>
<body
onload="return window_onload()">
<p
align="center">
<b>Scan an
image</b>
<object classid
= "clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<param
name="LPKPath" VALUE="DynamicWebTwain.lpk"/>
</object>
</p>
<form
id="frmScan">
<table
width="100%">
<tr>
<td>
<center>
<object
classid="clsid:FFC6F181-A5CF-4EC4-A441-093D7134FBF2"
id="DynamicWebTwain1" width="360" height="500"
CodeBase
= "DynamicWebTWAIN.cab#version=7,0">
<param
name="_cx" value="847"/>
<param
name="_cy" value="847"/>
<param
name="JpgQuality" value="80"/>
<param
name="Manufacturer" value="DynamSoft Corporation"/>
<param
name="ProductFamily" value="Dynamic Web TWAIN"/>
<param
name="ProductName" value="Dynamic Web TWAIN"/>
<param
name="VersionInfo" value="Dynamic Web TWAIN 7.0"/>
<param
name="TransferMode" value="0"/>
<param
name="BorderStyle" value="0"/>
<param
name="FTPUserName" />
<param
name="FTPPassword" />
<param
name="FTPPort" value="21"/>
<param
name="HTTPUserName" />
<param
name="HTTPPassword" />
<param
name="HTTPPort" value="80"/>
<param
name="ProxyServer" />
<param
name="IfDisableSourceAfterAcquire" value="0"/>
<param
name="IfShowUI" value="-1"/>
<param
name="IfModalUI" value="-1"/>
<param
name="IfTiffMultiPage" value="0"/>
<param
name="IfThrowException" value="0"/>
<param
name="TIFFCompressionType" value="0"/>
<param
name="IfFitWindow" value="-1"/>
</object>
</center>
</td>
</tr>
<tr>
<td>
<center>
<p align="center">
<input type="button"
value="|<" language=javascript onclick="return
btnFirstImage_onclick()"/>
<input type="button"
value="<" language=javascript onclick="return
btnPreImage_onclick()"/>
<!--webbot bot="Validation"
S-Data-Type="Integer" S-Number-Separators="," -->
<input type="text"
name="CurrentImage" size="2" id="CurrentImage"
readonly="readOnly"/>/
<!--webbot bot="Validation"
S-Data-Type="Integer" S-Number-Separators="," -->
<input type="text"
name="TotalImage" size="2" id="TotalImage"
readonly="readOnly" value="0"/>
<input type="button"
value=">" language=javascript onclick="return
btnNextImage_onclick()"/>
<input type="button"
value=">|" language=javascript onclick="return
btnLastImage_onclick()"/>
<p class="MsoNormal"
align="center">
<input type="button"
value="Scan Image" language=javascript onclick="return
btnAcquire_onclick()"/></p>
<p class="MsoNormal"
align="center">
<input type="button"
value="Delete current image" language=javascript onclick="return
btnDeleteImage_onclick()"/></p>
</center>
</td>
</tr>
</table>
</form>
</body>
</html>
No comments:
Post a Comment