Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, June 19, 2008 5:17:58 AM(UTC)
tempt632

Groups: Registered
Posts: 5


When trying to print images using the ActiveX control, I keep getting the following error when the Render method is called: "ltocx14n: LEAD Error: Invalid bitmap handle".  If i examine the bitmap property at this point it is zero. However, if i continue past the exception, the image will show up in the lead control.

The code at this point looks like this:
Lead.BitmapDataPath = "image.aspx";
var HDC = Lead.PrintStart();
Lead.Render(HDC, 0, 0, 0, 0); //exception being thrown here
Lead.PrintEnd(HDC);


I have discovered that if i inject something such as an alert dialog, and once the dialog is dismissed, the bitmap property is non-zero and the render method will succeed and execution will continue.

The code after causing a delay:
Lead.BitmapDataPath = "image.aspx";
alert("Let the image finish loading!"); //alert allows the image to finish loading
var HDC = Lead.PrintStart();
Lead.Render(HDC, 0, 0, 0, 0); //exception being thrown here
Lead.PrintEnd(HDC);


I have read the documentation and the documentation indicated that the ReadyState property should be examined to determine if an image is still being loaded or not.  However, the value of the ReadyState is always 4 and cannot be modiifed as it is a read only property.

Is there another method to tell when an image has finished loading or is still in the process of loading?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, June 20, 2008 12:56:29 PM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

I'd suggest looking at the ReadyStateChange event if you have not already done so. You'll want to set the BitmapDataPath and then wait for this event to fire. Once the event fires, you can then check to see that the ReadyState is equal to "READYSTATE_COMPLETE". There are examples in the documentation on using this event.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#3 Posted : Tuesday, June 24, 2008 5:31:59 AM(UTC)
tempt632

Groups: Registered
Posts: 5


Looking through the examples folder, i do not see any use of the ReadyState event or use of the ReadyState property in the context of the ActiveX control

Further, the lead object does not even have a method ( accessing the ActiveX control via javascript) or property representing the ReadyStateChange event.

Could you provide a short example ( or point to a specific example ) of how tap into this event through javascript?
 
#4 Posted : Thursday, June 26, 2008 7:52:15 AM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

I have attached a short example of how to use the ReadyStateChange event in Javascript.
File Attachment(s):
JS_ReadyStateEvent.zip (1kb) downloaded 24 time(s).
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#5 Posted : Monday, April 6, 2009 1:42:08 AM(UTC)
nareshdava

Groups: Registered
Posts: 2


Hi the example which you have given is very helpful for sure.
But i have a similar problem. I am trying to assign LEAD1.AnnDataPath also as soon as LEAD1.BitMapDataPath is set. I am able to load bitmappath and then go for setting anndatapath. But after setting anndatapath i am unable to check for the ready state value of the ready state change event called for anndatapath event.
Could you please send me the code snippet or example which would also load anndatapath also
 
#6 Posted : Monday, April 6, 2009 1:15:37 PM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

Hello Naresh,

These methods, BitmapDataPath and AnnDataPath, are asynchronous. In order to process both, you're going to need to block the page from executing any further before processing the second of the two methods.

Have you tried implementing something like the following?

"

function pausecomp(millis)
{
var date = new Date();
var curDate = nul\;

do { curDate = new Date(); }
while(curDate-date

while(number of pages ){
LEAD1.BitmapDataPath = "some_bitmap_file.bmp";
m_bBitmapDataPathSet = true\;
while(m_bBitmapDataPathSet)
pausecomp(500)\;
LEAD1.AnnDataPath = "some_bitmap_file.ann";
m_bAnnDataPathSet = true;
while(m_bAnnDataPathSet)
pausecomp(500);
...
}"


If you are having trouble with implementing this, please post a small sample project which illustrates this issue so that I can continue to help you with it. Here are a few guidelines about posting sample projects:

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB. If it is larger, please send an email to support@leadtools.com and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.

If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#7 Posted : Thursday, February 11, 2010 5:13:20 AM(UTC)

quasney  
quasney

Groups: Registered
Posts: 1


Sorry for bringing back the dead but I am having a similar problem as the original poster.

We are using a httphandler to pull the document. Some documents are on cart and take a while to pull. For some reason during this time leadtool's readystate is being set to 4 before the document is actually loaded.

I tried catching it by saying do nothing if the Lead1.InfoFormat != 0 (and wait until it is a non zero value, but I get a "ltocx14n, LEAD Error: Invalid file format"). And I also tried your example of having a hidden leadtool open the document then pass it to the main one. Both are failing.

Version=14,5,0,37

Any suggestions?

 
#8 Posted : Thursday, February 11, 2010 5:30:58 AM(UTC)
tempt632

Groups: Registered
Posts: 5


I should have done some follow up to begin with.  Note that the ready state is always 4 because from my understanding the ready state only applies to the control as is is being loaded to the page.  Prior to the control being loaded on the page, is the only time I have seen the ready state anything other than 4.

My solution has been to load the image to the control and then test the bitmap property.  When the bitmap property is > 0 (valid handle obtained) then the image is finished loading.

function Main()
{
  LoadImage("foo.jpg");
  DoStuff();
};
function LoadImage(imgSrc)
{
  Lead.Bitmap = 0;
  Lead.BitmapDataPath = imgScr;

};
function DoStuff()
{
  if(Lead.Bitmap < 1)
  {
    setTimeout("DoStuff()",50);
    return;
  }
  ...//continue processing
}
;
 
#9 Posted : Thursday, February 11, 2010 10:53:58 AM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

Hello Quasney,

The invalid file format error generally means that either the file filter dlls couldn't be found to load the image, or LEADTOOLS can't load the image either due to corruption or the format isn't supported at all.

To find out which the problem is, I would suggest trying to load the image with our main pre-compiled demo that ships with the SDK. If you can load the image with our main demo, than the issue is with the filter dlls. If you can't load it with our main demo, then we'll need to take a closer look at the image to see what the issue is with it and our SDK.

Your dlls are also very old. I would recommend sending an email to support@leadtools.com with the following information so we can send you the latest dlls to test with:
1. The company you work for
2. The LEADTOOLS serial number/numbers you own (if you are evaluating, just say so)
3. The name/names of the developer/developers using the serial number/numbers
4. A link to this forum post


Javd,
Thank you for posting back as well.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.125 seconds.