I'm working with a function named "scanning", which uses the methods TiffCreateMultiPageFromGdPictureImage, TiffInsertPageFromGdPictureImage and TiffAppendPageFromGdPictureImage, which are used depending on the position of the page. Everything works correctly when processed by ADF Simplex, the problem is when using ADF Duplex, because by using the method TiffInsertPageFromGdPictureImage pictures shown in disarray
Example:
Duplex scanning: pages.. 1, 2, 3, 4
The duplex Inserts: pages.. 5, 6 from page 2
Incorrect result 1, 2, 6, 5, 3, 4
Correct Score 1, 2, 5, 6, 3, 4
Code: Select all
var nMultipageTiffImage
function Scanning() {
try {
GdImaging.TwainOpenDefaultSource();
var nImageCount = (GdViewer.PageCount);
var nImageCurrent = (GdViewer.CurrentPage);
while (GdImaging.CreateImageFromTwain(0) != 0){
nImageID = GdImaging.GetNativeImage();
nImageCount ++;
if (nImageCount == 1) {
nMultipageTiffImage = GdImaging.TiffCreateMultiPageFromGdPictureImage(nImageID);
} else {
if ((nImageCurrent > 0) && (nImageCurrent < nImageCount)) {
GdImaging.TiffInsertPageFromGdPictureImage(nMultipageTiffImage, nImageCurrent + 1, nImageID);
} else {
GdImaging.TiffAppendPageFromGdPictureImage(nMultipageTiffImage, nImageID);
}
}
}
GdImaging.TwainCloseSourceManager();
GdViewer.SetNativeImage(nMultipageTiffImage);
GdViewer.DisplayFrame(nImageCurrent + 1);
}
catch (err) {
msj = "Se produjo un error en la funcion: Scanning().\n\n";
msj += "Descripción: " + err.message + "\n\n";
alert(txt);
}
}