Author |
Topic  |
|
mcherubin
Italy
7 Posts |
Posted - May 16 2025 : 09:55:49
|
Hi, I have a problem with scans using Twain drivers and DuplexEnabled, I have to scan documents such as driving licenses and identity cards (CIE), many times I find a facade in landscape and one in portrait, I tried to put combinations of these properties but the problem persists, Could someone help me? Thanks
AutoRotate := True; PDF_PaperLayout := ielLandscape; AcquireParams.Orientation := TIEAcquireOrientation(1);
 |
|
xequte
    
39027 Posts |
Posted - May 16 2025 : 16:49:20
|
Sorry, do you mean that one of the images is not rotating as expected? AutoRotate is handled by the scanner, so it will depend on its algorithm.
Nigel Xequte Software www.imageen.com
|
 |
|
mcherubin
Italy
7 Posts |
Posted - May 19 2025 : 03:01:58
|
Thanks for the reply, but even if I disable Autorotate I have an incorrect rotation of one of the 2 images, this is a front and back scan, so if Autorotate=false I expect at least that they are both in the same direction |
 |
|
xequte
    
39027 Posts |
Posted - May 19 2025 : 16:00:28
|
Please show us more of your code.
Nigel Xequte Software www.imageen.com
|
 |
|
mcherubin
Italy
7 Posts |
Posted - May 20 2025 : 01:37:05
|
This is my code, the comments are the various combination of options that I've try. Thanks
function ScanPDFTwain(ImageEnMIOScanner: TImageEnMIO; nomeFile: string; var msg: string): integer;
var
selScan, j : integer;
duplex: string;
resScan: boolean;
begin
result := 0;
with ImageEnMIOScanner do
begin
selScan := TrovaScannerTwain(ImageEnMIOScanner, NomeTwain);
if selScan >= 0 then
begin
TwainParams.SelectedSource := selScan;
TwainParams.AcquireFrameLeft := 0;
TwainParams.AcquireFrameTop := 0;
TwainParams.AcquireFrameRight := 0;
TwainParams.AcquireFrameBottom := 0;
TwainParams.PixelType.CurrentValue := 0;
TwainParams.XResolution.CurrentValue := 150;
TwainParams.YResolution.CurrentValue := 150;
//TwainParams.BufferedTransfer := false;
TwainParams.AutoRotate := false;
if (TWainParams.DuplexSupported and ScannerBifacciale) then
begin
TWainParams.DuplexEnabled := true;
end;
TwainParams.PixelType.CurrentValue := 2; // COLORI
TwainParams.VisibleDialog := false;
TwainParams.ProgressIndicators := false;
AcquireParams.VisibleDialog := false;
//AcquireParams.Orientation := TIEAcquireOrientation(1);
resScan := Acquire(false);
if (resScan) or (TwainParams.LastError = 0) then
begin
for j := 0 to ParamsCount - 1 do
begin
Params[j].PDF_PaperSize := iepAuto; //iepLetter
//Params[j].PDF_PaperLayout := ielLandscape;
Params[j].PDF_Compression := ioPDF_JPEG;
//Params[j].PDF_ImageOptions := [iepioShrinkOnly, iepioCentered];
Params[j].JPEG_Quality := 90;
end;
SaveToFilePDF(nomeFile);
UtilityMemoLog.Lines.Add('Scansione:' + nomefile);
UtilityMemoLog.Lines.Add('ParamsCount:' + IntToStr(ParamsCount));
result := 1;
if ((Pos(ScansioneNoDuplexCompletata, nomefile) > 0) and (not ScannerBifacciale)) or (ScannerBifacciale and (ParamsCount >= 2)) then
begin
TImageEnMView(ImageEnMIOScanner.AttachedMView).Clear;
TwainParams.FreeResources();
end;
end
else begin
TImageEnMView(ImageEnMIOScanner.AttachedMView).Clear;
msg := DecodificaErroreTwain(TwainParams.LastError);
UtilityMemoLog.Lines.Add('Errore Scansione: ' + msg + '(' + IntToStr(TwainParams.LastError) + ')');
result := 2;
end;
end
else begin
msg := 'Scanner ' + NomeTwain + ' non trovato.';
UtilityMemoLog.Lines.Add('ERRORE: ' + msg);
result := 3;
end;
end;
end;
|
 |
|
xequte
    
39027 Posts |
Posted - May 20 2025 : 20:32:12
|
Hi
Can you try using a TImageEnMView, e.g.
ScanPDFTwain( ImageEnMView1.MIO, nomeFile, msg );
Then when you scan, do the images look correctly rotated in the TImageEnMView?
Nigel Xequte Software www.imageen.com
|
 |
|
mcherubin
Italy
7 Posts |
Posted - May 21 2025 : 02:15:47
|
Hi, I had already tried to use the TImageEnMView component and even in the view they were with different orientations, in fact in my initial post I reported exactly what you see in TImageEnMView |
 |
|
xequte
    
39027 Posts |
Posted - May 21 2025 : 15:46:12
|
Hmmm, I can't see any good reason for that. What version of ImageEn is this?
Nigel Xequte Software www.imageen.com
|
 |
|
mcherubin
Italy
7 Posts |
Posted - May 22 2025 : 02:12:06
|
I've download this version ImageEn_SRC_13.2.0_42696 and I tried all the possible combinations before open this thread |
 |
|
xequte
    
39027 Posts |
|
mcherubin
Italy
7 Posts |
|
xequte
    
39027 Posts |
Posted - May 22 2025 : 17:26:32
|
Hmmm, I can't see anything in the log file. Does it only do it on this one scanner?
Nigel Xequte Software www.imageen.com
|
 |
|
mcherubin
Italy
7 Posts |
Posted - May 23 2025 : 01:56:26
|
We use this Ricoh Fi800R scanner in all our installations because it is a scanner designed to process documents such as identity cards, driving licenses, passports and in all the installations that we have encountered this problem. Having images with different rotations in the same PDF did not create problems for us when we used the file only to save it, but now we are using the PDFs generated for an OCR and having images with different orientations within the same PDF makes them difficult to process by the OCR software |
 |
|
xequte
    
39027 Posts |
Posted - May 26 2025 : 01:04:46
|
OK, thanks for clarifying. I've passed the log file onto my partner to see if he has any suggestions.
Nigel Xequte Software www.imageen.com
|
 |
|
|
Topic  |
|