This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, October 18, 2007 2:50:00 PM(UTC)
Groups: Registered
Posts: 18
When I scan multiple pages using this example (CSFastTwainDemo) , from second page on
TwainAcquirePageEventArgs.Image properties are throwing null exception.
Eg;
Page1 - Works fine
BitsPerPixel = 8
BytesPerLine = 2552
DataSize = 8421600
etc
Page2
BitsPerPixel = 'e.Image.BitsPerPixel' threw an exception of type 'System.NullReferenceException'
BytesPerLine = 'e.Image.BytesPerLine' threw an exception of type 'System.NullReferenceException'
etc
Can you please check this?
Thanks,
Sudheer
#2
Posted
:
Saturday, October 20, 2007 10:56:37 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
Do you mean that the problem is active on the CSFastTwainDemo that ships with the LEADTOOLS SDK?
I want to check this demo on my side.
What is the exact LEADTOOLS version (v14, v14.5, v15, etc.) that you use?
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Monday, October 22, 2007 9:00:44 AM(UTC)
Groups: Registered
Posts: 18
Yes, After assigning the image to the viewer all image properties are null from second image on.
LEADTOOLS version is V15
Thanks.
#4
Posted
:
Monday, October 22, 2007 11:29:02 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
I checked the following code in the CSFastTwainDemo and didn't notice the problem:
+--------+
private void _twain_AcquirePage(object sender, TwainAcquirePageEventArgs e)
{
try
{
if(_transferMode != TwainCapabilityValue.TransferMechanismFile)
{
if(e.Image != null)
{
if(_viewer.Image == null)
{
_viewer.Image = e.Image;
_miViewPrevious.Enabled = false;
_miViewNext.Enabled = false;
}
else
{
_viewer.Image.AddPage(e.Image);
_viewer.Image.Page = _viewer.Image.PageCount;
_miViewPrevious.Enabled = true;
_miViewNext.Enabled = false;
}
_miFileSave.Enabled = true;
}
}
else
MessageBox.Show(this, "Acquired page(s) is saved to file(s)", "Acquire to File");
}
catch(Exception ex)
{
Messager.ShowError(this, ex);
}
}
+--------+
When you scan Multi-Pages using the CSFastTwainDemo, if you debug the above code in the demo, what is the value of the e.Image for each page?
Also, what is the build number of the LEADTOOLS .Net DLLs that you use?
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#5
Posted
:
Tuesday, October 23, 2007 8:35:47 AM(UTC)
Groups: Registered
Posts: 18
Hi,
15.0.0.0
Debug the code and check the image properties of e.Image from second page ('else' part) on after assigning the image to the viewer (_viewer.Image.AddPage(e.Image);), Before assigning it to viewer image properties are okay, after assigning image properties throwing null exception.
Example
Data = 'e.Image.Data' threw an exception of type 'System.NullReferenceException'
DataSize = 'e.Image.DataSize' threw an exception of type 'System.NullReferenceException'
etc
Thanks.
#6
Posted
:
Tuesday, October 23, 2007 10:25:56 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
You are using a pretty old version of LEADTOOLS v15 DLLS.
It's highly recommended to recheck the same issue by using the latest LEADTOOLS v15 patches.
Please send your serial number to
support@leadtools.com and ask about the latest LEADTOOLS v15 patches. Also, don't forget to mention this forum in your email to support.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#7
Posted
:
Wednesday, October 24, 2007 9:15:56 AM(UTC)
Groups: Registered
Posts: 18
Hi,
Just added the patch, now the Leadtools.dll version is 15.0.0.29, But it still behaving the same way like before. Nothing has changed.
Thanks.
#8
Posted
:
Wednesday, October 24, 2007 11:50:08 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
I investigated more about this issue. To resolve the problem, when you display any image on a rasterImageViewer control, use the clone method.
For example, the following code shows how to display an image on a RasterImageViewer control by using the clone method:
+---------------+
RasterImageViewer1.Image.AddPage(e.Image.Clone());
RasterImageViewer1.Image = e.Image.Clone();
+---------------+
Please retry the same issue by using the clone method and let me know how it goes.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#9
Posted
:
Thursday, October 25, 2007 8:42:21 AM(UTC)
Groups: Registered
Posts: 18
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.