ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 With DuplexEnabled 1 face landscape e 1 face portarit issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

mcherubin

Italy
7 Posts

Posted - May 16 2025 :  09:55:49  Show Profile  Reply
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  Show Profile  Reply
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
Go to Top of Page

mcherubin

Italy
7 Posts

Posted - May 19 2025 :  03:01:58  Show Profile  Reply
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
Go to Top of Page

xequte

39027 Posts

Posted - May 19 2025 :  16:00:28  Show Profile  Reply
Please show us more of your code.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

mcherubin

Italy
7 Posts

Posted - May 20 2025 :  01:37:05  Show Profile  Reply
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;
Go to Top of Page

xequte

39027 Posts

Posted - May 20 2025 :  20:32:12  Show Profile  Reply
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
Go to Top of Page

mcherubin

Italy
7 Posts

Posted - May 21 2025 :  02:15:47  Show Profile  Reply
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
Go to Top of Page

xequte

39027 Posts

Posted - May 21 2025 :  15:46:12  Show Profile  Reply
Hmmm, I can't see any good reason for that. What version of ImageEn is this?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

mcherubin

Italy
7 Posts

Posted - May 22 2025 :  02:12:06  Show Profile  Reply
I've download this version ImageEn_SRC_13.2.0_42696 and I tried all the possible combinations before open this thread
Go to Top of Page

xequte

39027 Posts

Posted - May 22 2025 :  03:24:18  Show Profile  Reply
Hi

Please enable logging and attach your Twain debug log:

http://www.imageen.com/help/TIETwainParams.LogFile.html


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

mcherubin

Italy
7 Posts

Posted - May 22 2025 :  04:44:35  Show Profile  Reply
This is the log file of a scan with the rotation problem



attach/mcherubin/202552244650_scanner.zip
2.35 KB
Go to Top of Page

xequte

39027 Posts

Posted - May 22 2025 :  17:26:32  Show Profile  Reply
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
Go to Top of Page

mcherubin

Italy
7 Posts

Posted - May 23 2025 :  01:56:26  Show Profile  Reply
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
Go to Top of Page

xequte

39027 Posts

Posted - May 26 2025 :  01:04:46  Show Profile  Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: