Monthly Archives: February 2006

Html Snapshot Sample in Windev

WINDEV, a powerful IDE, lets you build strategic projects easily and quickly thanks to its total integration, ease-of-use and cutting-edge technology.
Support .Net, Java code and more!

I don’t use Windev before. This Windev example is kindly provided by one of our customers.

 

I have a look at the syntax of the language in Windev. It looks like a scripting language that has support for ActiveX. And it should be easy to use.

If you use Windev for development and want to convert html to image or tiff reports. This example can help you on how to use html snapshot with Windev.

 

Track bugs by reproduction

Software always has “bugs”. This is because the software running environment varies a lot. You may use a computer which installs incompatible programs, or you may lose some dependency DLLs that the program requires, or the software developer like us didn’t consider carefully on certain scenarios. Don’t worry about bugs too much. We will find way to fix it or make a workaround somehow.

But to effectively identify a bug, it is good to have a systematic way to attack it. So when you find a software doesn’t work properly as you wish. Narrow down the condition that can reproduce the problem.

For our component product, most of users are experienced developers. Some users are really good at reproducing bugs. They found a flaw, and then they tried to remove unnecessary codes and finally got a smallest program that can show the problem. This program is useful to us greatly. From it, we can reproduce the bug and find the fix quickly. It is far more effective than simply describing the phenomena of the problem.

Do you think so?

Html To Image: GetImageBytes method

Some times you may not want to write the image converted from html page to an image file. You may want to write the image data to another place like a network stream or a database, etc.

GetImageBytes is designed for this kind of scenerio. It is used to do in memory compression of the bitmap from html. It has one string parameter, which can be .jpg, .tiff or .png etc. to represent the image coding format. Then html snapshot will do compression and return an OLE byte array (1 dimension) that holds the compressed data.

Then you are free to write the data to anywhere. We have provided a VBScript demo in the blob.vbs. Here is another C# demo.

After you call SnapUrl and it returns, you can do the following:

                    byte[] data = (byte[])snap.GetImageBytes(“.tiff”);
                    //MessageBox.Show(data.Length.ToString());
                    FileStream  fs = File.OpenWrite(@”c:1.tiff”);   
                    BinaryWriter br = new BinaryWriter(fs);

                    br.Write(data);
                    br.Close();
                    fs.Close();

DSCN1414.JPG

 

Word press update

WordPress developers released a new version. I will update my blog soon.

Quick update is very important. Even large corp. like Microsoft has to use constant update to secure its users. In today’s internet world, security bugs are the most critical ones.

I had a PHP board here before to support the customers. But it is hacked by some bad guy by using some kind of security bug of the php script. It is bad experience.

It is good that I can see the update information of wordpress when entering admin UI of wordpress. This is a good user experience to notify user like me to update in time

 

 

Want PDF to image?

Do you need a PDF to image control?

While there are already many PDF to image products on the net, there is a simple way by using GhostScript.

Ghostscript supports PS and PDF formats. It can render them to different devices suh as TIFF, PNG or printer. The DPI of rendering can be changed.

But pay attention to the license of Ghostscript if you want to use.

 

Got back from vacation

Now regular word and life begin again. :)

Althrough I have managed to post three short notes from mobile devices for the last three days, the net speed is really slow on the devices. Now I am enjoying fast surfing experience again. Great!

If you have any comments on our posts, feel free to post it here. This blog is monitored daily. And I need your feed back and encouragements.  :)

Now the spring is coming! Have you heard the sound of new green life? See below:

DSCN1335.JPG

 

Redistribute html to image

After integrating html snapshot with your application, the next thing may be redistributing it so that every user of the app. can convert html to image by installing your app.
For registered users, it’s totally free to redistribute the htmlsnap2.dll.
Since htmlsnap2.dll is an ActiveX server, it must be registered like any other ActiveX component on the user’s machine.
Usually this can be done in the installer. Almost every installer maker supports ActiveX self registration such as inno setup. Or it can be done with regsvr32 tool.
Gdiplus.dll is also necessary to be redistributed on win2000 below machines.

Another html to image note

When doing html to image conversion with html snapshot, the image will be rendered with current display context.
So to achieve the best image quality, the display mode needs to be in true color mode, either 24 or 32 bits. Almost every video card can support the above mode nowadays.
The other thing related is the remote desktop issue. The remote desktop supports desktop display in 256 color mode, this has the effect of setting the remote display to 256 color mode. Be aware of this when doing html to image on remote server with remote desktop.

One html to image note

Currently html snapshot converts the whole html document into an image.
Html document may be very large so the resulted image will be large as well. If the video card ram memory on the machine is low, the bitmap image may not be able to be held for rendering. So it will lead to a snap failure.

One solution is to make the html smaller so that the image is in reasonable size to be handled.