Quantcast
Channel: Saraff.Twain.NET
Viewing all articles
Browse latest Browse all 419

New Post: Problems with image transfer

$
0
0
Hello Saraff,

I have problems to get the scanned image presented in a picture box of my program.
I have used (almost) exactly the code, you provided in your sample_1 (the simple one).
If I run this sample (x86 Version) it works fine, but not, if I call the scanner from my application.
I use for testing an Epson Perfection 4990.
I can select the scanner and I can bring up the EpsonScan GUI and the scanning starts.
But when it is finished, the image is not presented in my picture box.

Have you ( or anyone else ) any Idea, what might be the reason.

I have uploaded a Screenshot which shows the relevant section of my code, the Main Window of my application with the picture box at the bottom of this window (designated in red).
And it shows the scanning in progress.

I develop using MS VisualStudio Community 2015 under Windows 10 (64 Bit) and I use the
LightPath.Set to TwLP.Transmissive (which works fine so far).

see the screenshot at:
http://wkurz.com/upload/Image-not-transferred-to-pBxStrip.jpg

For any hint, what might be the reason I would be very greatfull.
Wolfgang

Addition:

I have still the problem to get the ImageLayout accepted by the scanner.
It always scans the complete window ( 6 x 8 inches) when
"_twain.ShowUI = false;" is set in front of the relevant Acquire statement.

This is the code I currently use for capbility negotiation.
Is there something wrong ? (Units = inches. All values provided in inches)
        TwImageLayout theImageLayout = new TwImageLayout();  
        aFrame = new RectangleF(imgX, imgY, imgWidth, imgHeight);
        this._twain.Capabilities.Frames.Set(aFrame);
        this._twain.Capabilities.PixelType.Set(TwPixelType.RGB);
        this._twain.Capabilities.ImageFileFormat.Set(TwFF.Bmp);
        _selectedResolution = ConvertStringToFloat(theIniFile.GetIniField("stripResolution"));
        this._twain.Capabilities.XResolution.Set(_selectedResolution/10);  // reduced for testing
        this._twain.Capabilities.YResolution.Set(_selectedResolution/10);
        this._twain.Capabilities.LightPath.Set(TwLP.Transmissive);

        theImageLayout.Frame = aFrame;
        theImageLayout.DocumentNumber = 0;
        theImageLayout.PageNumber = 0;
        theImageLayout.FrameNumber = 1;
// for testing:
        float widthF  = this._twain.ImageLayout.Width;
        float heightF = this._twain.ImageLayout.Height;
        float topF    = this._twain.ImageLayout.Top;
        float leftF   = this._twain.ImageLayout.Left;

        Console.WriteLine("657 ImageLayout Type = " + this._twain.ImageLayout.GetType()+", widthF="+widthF+", heightF="+heightF+", topF="+topF+", leftF="+leftF);
This test stetement shows the used values but the scanner does something else.

Wolfgang

Viewing all articles
Browse latest Browse all 419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>