Stack error with VS2005

Recently I found an issue with our VB.Net and C# demo for PDF components. When compiling with VS2005, the component will fail to be initialized with a stack overflow error. The one compiled with VS2003 (.Net 1.1), the VB, VBScript demo all works well. So I doubt if this is a bug of .Net 2.0.

Overal it is very strange error. The current workaround I found is to call the PDF methods in a second thread which can work well on both .Net 1.1 and 2.0.

Here is the new demo codes for our PDF Split and Merge component.

  Private Sub DoTest()
        Dim pdf As PDFSplitMerge.CPDFSplitMergeObj

        pdf = New CPDFSplitMergeObj

        pdf.SetCode(“Your license code here”)

        pdf.Split(“..1.pdf”, “1;1;1″, “..sp1-%d.pdf”)
        pdf.Split(“..1.pdf”, “1;2;3;4;1-2,3-4;1″, “..sp%d.pdf”)

        pdf.Merge(“..sp0.pdf|..sp1.pdf”, “..m1.pdf”)
        pdf.Merge(“..1.pdf?1-2|..sp1.pdf”, “..m2.pdf”)
        pdf.Merge(“..1.pdf?1-2|..sp1.pdf?2″, “..m1.pdf”)

        pdf = Nothing
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim job As Thread

        job = New Thread(New ThreadStart(AddressOf DoTest))
        job.Start()
        job.Join()
    End Sub

I will keep it updated if we find more deep reason for this issue.

 

Convert html to image at a given size.

Html snapshot can capture the whole html page into image as JPG, TIFF and PNG etc. Sometimes, you may not need a full image but an image at a given width and height. There are several ways to do this:

 1. Use EnableSnapDimensionAsImageSize and SetSnapDimension

     ‘demo how to convert html to image

Dim snap

‘Create the Html Snapshot Object
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)

‘Set the time to wait for web page loading
snap.SetTimeOut CLng(200000)

‘Set the browser window size
snap.SetSnapDimension 250, 250

‘Set this if you want the image size exactly to be 1000,1000
snap.EnableSnapDimensionAsImageSize 1

‘Begin to capture the web page
snap.SnapUrl “http://www.google.com/“, “google.jpg”

‘Free object
Set snap = Nothing

 

2. Use SetClipRect method then you can get out the image with GetBitmapHandle after calling SnapUrl.

3. Get out the whole image with GetBitmapHandle and apply post processing to cut it into any size as you wish
 

Tutorial: Install php and run html snapshot with IIS

So you are a PHP fan that wants to convert html to image? You can do it with html snapshot with php on windows server. This tutorial shows how to do this with php and IIS. ( Apache for windows can also be used as well.)

My steps (based on Win2003)
1. Download php for win32 from php.net
http://www.php.net/downloads.php

Using PHP 5.1.4 zip as example,
extract the files to c:php

Following the instruction here to enable php in IIS
http://www.simongibson.com/intranet/php2003/
2. Write a small php with the expression and put it to c:inetpubwwwroot to test if php works
. Make sure it is ok

3. Download html snapshot free trial. Install it on the server. Get the php demo and put it in wwwroot. Make sure your IIS account (IUSR_MachineName) can write to the folder that will save the image file.  Alternatively, you can also call SetLogOnUser before calling SnapUrl.

 The example code I used is here:

< ?php

$url = “http://www.google.com/“;
$path = getcwd().”\”;
$img = “1.jpg”;
$timg = “1s.jpg”;

$com = new COM(“HTMLSNAP2.HtmlSnap.1″);

$com->SetLogOnUser(“user”, “.”, “user”);

$com->SnapUrl($url, $path.$img );

$com->GetThumbnailImage($path.$img, $path.$timg, 100, 100, 1);

print “Snapshot of “.$url.”. Click to enlarge
“;
 
?>

Load the php page in IE, you will find the image converted from html in your wwwroot folder.  

Note that I call SetLogOnUser method with an account named “user”. This could be an account that is created specially for converting html to image. You can give him enough privilege to write files or loading ActiveX like flash movie. It can be an Administrator account (needed for capturing flash). Security concern? It is no problem since Html snapshot will only impersonate that user when doing html to image. It will revert to normal web user after SnapUrl call. So it is secure. :)

 

 

 

Convert html to EMF and WMF with html snapshot

As you know, Html snapshot can convert html to raster image format like jpg, jpeg, tiff, png, gif and bmp.

Now it can convert html to vector image format like EMF and WMF. It is a new feature of html snapshot. Hope you like it.

EMF/WMF are the meta file format supported natively by Windows based OS. It is vector image format which means the image is not defined pixel by pixel. Instead, a series of drawing operations are used to render the image.

 

Using Plimus

We are using Plimus.com as one of our payment gateway. The admin pages seems to be powerful. There is one thing I feel strange is that I cannot find a plimus logo on their site like the following one.
Purchase this product NOW at www.plimus.com for International UsersPlimus uses the highest level of encryption throughout the entire order and setup processes, from all order pages, through the storage of customer information, and credit card processing which is done by Wells Fargo, one of the largest and most trusted financial institutions.There is a variety of payment options: Visa, MasterCard, EuroCard, American Express, Discover/Novus, Diners Club, JCB, US$ Checks, Eurochecks, Wire Transfers, Paypal and Purchase orders.

Record left and right channel independently

As we know, normal sound card supports stereo channels. In some cases, you may just want mono channel data. You can combine two mono channel signals into stereo one so it can be captured by one sound card.   

Our audio record component  support recording the left and right channel to different files.

Here is an example in script.

Set WshShell = WScript.CreateObject(“WScript.Shell”)

set rec = CreateObject(“AudioCtl.AudioRecord.1″)

rec.DeviceIndex = 0

rec.DeviceLineIndex = 3

‘test save to mp3

rec.WaveFormatIdx = 15

rec.SetOutputFileName “stereo.mp3″

 

‘set the wave format for the left and right channel

rec.WaveFormatIdxLR = 5

rec.SetOutputFileNameL “L.mp3″

rec.SetOutputFileNameR “R.mp3″

 ’start recording

rec.StartRecord 2, 44100

WScript.Sleep 10000

rec.StopRecord

 

‘Test, save to wav

rec.FileFormat = 0

rec.WaveFormatIdx = 31

rec.SetOutputFileName “stereo.wav”

‘set channel wave format 

rec.WaveFormatIdxLR = 30

rec.SetOutputFileNameL “L.Wav”

rec.SetOutputFileNameR “R.Wav”

 

rec.StartRecord 1, 44100

WScript.Sleep 10000

rec.StopRecord

set rec = NOthing

 

 

TIFF to PDF

We just released TIFF TO PDF ActiveX product.

It supports convert tiff to PDF files. Have a try now!  Here are the feature detail:

  • Convert TIFF files to PDF
  • Support single or multiple page TIFF
  • Support various TIFF encoding such as CCITT G3/G4, LZW, RLE and uncompressed
  • Merge multiple TIFF files into one PDF
  • Standalone, doesn’t depend on Adobe Acrobat or Reader
  • Convert PDF To images: TIFF, JPEG, PNG, FAX and BMP
  • Provide demos in ASP, VB, VB Script, VB.Net
  •