Archive for the ‘Uncategorized’ Category

convert html to image with htmlsnapshot in php

Saturday, March 1st, 2008

Here are a more complete examples of using htmlsnapshot to convert html to image with php on Windows.

Note the following things:

1. You copy/paste the below code into test.php and run on command line

   php.exe test.php

 2. Yon can see it uses GetErrorCode to handle errors to make your code more robust.

<?php

$url = “http://google.com/“;
$path = “.\\”;
$img = “1.jpg”;
$timg = “1s.jpg”;
$limg = “1b.jpg”;
$iimg = “1i.jpg”;

$com = new COM(“HTMLSNAP2.HtmlSnap.1″);
$com->SetTimeout(150000);
$com->SetDelayTime(5000);
$com->EnableActiveX(true);
$com->EnableJava(true);
$com->EnableScript(true);
$com->EnableActiveX(true);
$com->SetJPEGQuality(100);
$com->SetSmoothingMode(2);
$com->SetInterpolationMode(6);
$com->SnapUrl($url, $path.$img );

$err = $com->GetErrorCode();
if ($err == 1)
{

$com->SetClipRect(0, 0, 1024, 768);
$com->SaveImage($path.$iimg);

$com->GetThumbnailImage($path.$img, $path.$timg, 160, 120, 0);
$com->GetThumbnailImage($path.$img, $path.$limg, 320, 240, 0);
$com->Clear();

print “Snapshot of “.$url.”. Click to enlarge<br>”;
print “<a href=”.$iimg.” mce_href=”.$iimg.”><img src=”.$timg.” mce_src=”.$timg.”><img src=”.$limg.” mce_src=”.$limg.”></a><br/>”;
}
else
{
    print “error happens”;
}
 
?>

A handy script to convert html to image

Monday, February 11th, 2008

You may need to run a command line utility to convert html or url to image. Here is a handy script that converts url/html to image with our award winning htmlsnapshot product.

Save the below code into a script snapurl.vbs (Or you can find this script in htmlsnapshot\demo\vbscript)

set args = WScript.Arguments
num = args.Count

if num <> 2 then
   WScript.Echo “Usage: [CScript | WScript] snapurl.Vbs Url ImageFile”
   WScript.Quit 1
end if

‘demo how to convert html to image
Dim snap

‘Create the Html Snapshot Object
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
snap.SetCode “Input your license code here to remove watermark”
snap.SnapUrl args.Item(0), args.Item(1)
WScript.echo “Snap return:” & CStr(snap.GetErrorCode)

‘Free object
Set snap = Nothing

 After that, you can run on command line like below:

cscript.exe snapUrl.vbs www.google.com g.jpg
cscript.exe snapUrl.vbs file://c:\1.html g.jpg

Capture silverlight web page into image

Thursday, February 7th, 2008

Silverlight is the new web authoring technology proposed by Microsoft. It is implemented as an ActiveX like the Flash.

It can be used to build interactive, vector based web pages.

To convert such web page into image, you can do it with our award winning htmlsnapshot product.

50 good wordpress plugin list

Tuesday, January 1st, 2008

Manage WordPress Comments

  • Subscribe To Comments – Allows readers to recieve notifications of new comments that are posted to an entry.
  • WP AJAX Edit Comments – Allows users and admins to edit comments on a post inline using AJAX.
  • Get Recent Comments – displays excerpts of the most recent comments and/or trackbacks that have been posted to the articles in your blog.
  • Close Old Posts – Closes comments on old posts without any DB queries.
  • WP Grins – allows you to put clickable smilies on your post and comments forms.
  • WordPress Paged Comments – allows comment paging. Useful for those very popular blog entries receiving many comments.
  • Live Comment Preview – the simplest way to get live comment previews on your site.
  • Show Top Commentators – Encourage more discussion from your readers, by displaying their names and number of comments they have made recently to your sidebar.
  • WordPress Gravatar Plugin – outputs the gravatar based on the commenters email address.
  • MyAvatars – shows MyBlogLog’s avatars in your comments
  • Comment Relish – Sends a thank you e-mail to your first time commentators.
  • Favatars – displays the favicon associated with the commenter’s website.
  • Brian’s Threaded Comments – adds a ‘Reply to this comment’ link to every comment. Makes it easy for people to reply to comments and discuss better.
  • Dofollow – lets you remove the nofollow attribute from your comments.
  • OpenID Comments for WordPress – allows users to leave comments using their OpenID.
  • Extended Comment Options – allows you to switch comments and/or pings on or off for batches of existing posts.

Stop WordPress Spam

  • Akismet – intelligently blocks spam comments. Checks your comments against the Akismet web service to see if they are spam or not.
  • Spam Karma 2 (SK2) – is an anti-spam plugin for the WordPress meant to stop all forms of automated Blog spam effortlessly, while remaining as unobtrusive as possible to regular commenters.
  • Bad Behavior – is a set of PHP scripts which prevents spambots from accessing your site by analyzing their actual HTTP requests and comparing them to profiles from known spambots.
  • Math comment spam protection – Adds a math question to comments form to detect human input and block automated spambots.
  • WP-Contact Form with Spam Protection – creates a contact form on your blog, through which your readers can contact you easily.

Expert WordPress SEO

  • Google XML Sitemaps Generator – creates a sitemap of all articles on your WordPress blog. Helps Google and other search engines index every article you write.
  • Permalink Redirect – replies a 301 permanent redirect, if requested URI is different from entry’s (or archive’s) permalink. It is used to ensure that there is only one URL associated with each blog entry.
  • All in One SEO Pack – Optimizes your WordPress blog for Search Engines (Search Engine Optimization).
  • Head META Description – Insert HTML META description tags using post excerpts.
  • SEO Title Tag – Optimize your wordpress title tags for search engines. Mass edit the title tags of posts, pages, category pages, tag pages etc.
  • Enforce www. Preference – will help preserve your permalinks by enforcing your no-www or yes-www preference and will strip off index.php from the ends of URIs.
  • Optimal Title – allows you to have your blog name tacked on to the end of the page title instead of having it appear first.
  • Quick META Keywords – will automatically add META Keywords tags to every single post based on categories under which the article is categorized.

Easy WordPress Navigation

  • Related Posts – Returns a list of the related entries based on active/passive keyword matches. Increase pageviews by providing targeted related content.
  • WP-PageNavi – Adds a more advanced page navigation to WordPress, which is very useful for navigation on index and category pages.
  • Evermore – Abbreviate all posts when viewed on multiple post pages. Helpful to create expandable posts summaries in WordPress. Combine with Less that changes the (more…) link so it displays the entire post, not just the part after the “more”.
  • Random Redirect – Allows you to create a link to a random post on your blog. Lets readers browse in a StumbleUpon-like fashion.
  • Lightbox JS Plugin – used to overlay images on the current page into neat Javascript-powered overlay popups.
  • WordPress Mobile Edition – shows an interface designed for a mobile device when visitors come to your site on a mobile device.
  • Popularity Contest – keeps a count of your post, category and archive views, comments, trackbacks, etc. and uses them to determine which of your posts are most popular.
  • Extended Live Archive – implements a dynamic, AJAXified way of digging into the archives of a blog.
  • Landing Sites – When visitors is referred to your site from a search engine, it shows them related posts to their search on your blog.
  • Clean Archives – designed to display your archive listings in a clean and uniform fashion. It lists the Month / Year, the day of the month the article was published, the title of the article, and the number of comments that have been made on each article.
  • Custom Query String – set the number of posts (custom queries) for every single page on your website like categories, archives, or search results pages.
  • Feed List – very useful for adding other RSS feeds to your site.
  • Sidebar Widgets because it allows you to move things (widgets) around, in and out of your sidebar. Not required for WordPress 2.2 and above.
  • KB Advanced RSS Widget – a wordpress widget that gives you complete control over how RSS feeds are parsed for your sidebar.
  • Category Cloud Widget – Adds a sidebar widget to display the categories as a tag cloud.
  • Adhesive – lets you make the posts “sticky”, such that the posts will remain at the top of the page.
  • Permalinks Migration Plugin – safely change your permalink structure without breaking the old links to your website or affecting your search engine rankings.

Interactive WordPress Posts

  • Share This – lets your visitors to add your post to various social bookmarking sites, or send a link via e-mail to a friend.
  • Digg this – detects incoming links from Digg.com to your wordpress post and automatically display a link back to the digg post, for people to digg your story.
  • Delicious Cached++ – uses the built-in MagpieRSS engine functions to create a list of the latest bookmarks on a del.icio.us account, from its RSS feed, keeping the feed cached in the database.
  • WP-Notable – displays a series of icons below each post allowing your readers to easily submit you to many different social bookmarking and networking sites.
  • WP-Email – Allows people to recommend/send your WordPress blog’s post/page to a friend.
  • WP-PostRatings – Adds an AJAX rating system for your WordPress blog’s post/page.
  • EasyTube – allows you to easily embed YouTube and Google Videos using one simple tag.
  • Twitter Updater – automatically sends a Twitter status update to your Twitter account when you create, publish, or edit your WordPress post. More best Twitter plugins.

WordPress Admin Management Tools

  • WordPress Database Backup – On-demand backup of your WordPress database. Back up your blog today.
  • WP-cache – Very fast cache module. Survive a Digg traffic spike easily.
  • WP-Supercache – A modification of WP-Cache that produces static html files.
  • Batch Categories – Easily manage the mass categorization of posts that match various criteria. Power edit your categories.
  • podPress – adds lots of features designed to make WordPress the ideal platform for hosting a podcast.
  • TinyMCE Advanced – adds 16 plugins to TinyMCE, the WordPress wysiwyg editor. Adds over 40 new buttons to the toolbar, which is now two rows plus one hidden row.
  • Exec-PHP – allows php tags inside the content or excerpt of your posts and pages to be executed just as in usual PHP files.
  • WordPress Reporter – allows you to easily view your Google Analytics and Feedburner reports in your WordPress administration area.
  • WordPress.com Stats – Tracks views, post/page views, referrers, and clicks. Requires a WordPress.com API key.
  • WP Tiger Administration – Uses power of CSS2 to manipulate the functionality of the WordPress administration area
  • Admin Drop Down Menu – eliminates the need for this double clicking on the Admin screens by allowing you to see the second level menu just by placing your mouse over a main menu.
  • InstantUpgrade – provides is a easy and safe way to upgrade your WordPress automatically with a single click.
  • Maintenance Mode Plugin – Adds a splash page to your blog that lets visitors know your blog is down for maintenance. Logged in administrators get full access to the blog including the front-end.
  • Theme Test Drive – allows you to safely test drive any theme on your blog as an administrator, while visitors continue to see the default one.

Advertising on WordPress

  • Ad Rotator – Rotates Ads randomly from a specified text file.
  • AdSense-Deluxe – is a WordPress plugin offering advanced options for managing the automatic insertion of Google AdSense or Yahoo Publisher Network (YPN) ads to your WordPress posts. More Google Adsense WP plugins.
  • Buy Me a Beer – allows your readers to donate money to you via PayPal on pretext of buying a beer.
  • WordPress BankRoll – offers to help you cut out the middleman by allowing advertisers to buy reviews directly on your blog.

WordPress Blog Translation

Enhance WordPress RSS Feeds

  • Feedburner Feedsmith – Forwards all feed traffic to Feedburner while creating a randomized feed for Feedburner to pull from.
  • Simple Feed Copyright – adds a simple copyright notice to full text wordpress feeds.
  • Full Text Feed – Prevents WordPress 2.1+ from adding a more link to your website’s feed. Ensures you get full text feeds.
  • Add Related Posts to Your Feed – adds a list of Related Posts to your full text feed. Requires either UTW or Related Posts plugin installed and activated.
  • RSS Signature – allow the addition of a custom tagline, signature or copyright message to the wordpress generated rss feeds.

Random WordPress Stuff

  • Democracy – adds AJAX polling functionality to your WordPress blog.
  • flickrRSS – allows you to easily display Flickr photos on your weblog

Convert html to multipage tiff file

Tuesday, December 25th, 2007

 Htmlsnapshot now supports converting html into multiple page tiff files. here is the sample code. You just need to specify the page width in pixel. The component will save the image into a multipage tif.

‘demo html to multipage tiff generation function

Set WshShell = WScript.CreateObject(“WScript.Shell”)
‘Declare object
Dim snap
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
snap.SetTimeOut CLng(200000)
snap.SnapUrl “http://www.google.com/“, “google.tiff”

‘Set CCITT3 encoding for TIFF
snap.SetTIFFEncoder 1
snap.SaveMultipageTiff “m-google-ccitt-3.tiff”, 200

‘Set CCITT4 encoding for TIFF
snap.SetTIFFEncoder 2
snap.SaveMultipageTiff “m-google-ccitt-4.tiff”, 200

‘Set RLE encoding for TIFF
snap.SetTIFFEncoder 3
snap.SaveMultipageTiff “m-google-rle.tiff”, 200

‘Set none encoding for TIFF
snap.SetTIFFEncoder 4
snap.SaveMultipageTiff “m-google-none.tiff”, 200

snap.SetTIFFEncoder 1

‘Change thresholding when converting to monochrome
snap.SetThreshold 200
snap.SaveMultipageTiff “m-google-ccitt-4-1.tiff”, 200

Set snap = Nothing

SnapHtmlString wtih CSS

Saturday, November 24th, 2007

It is possibe to use html CSS sheet with SnapHtmlString when converting a html string to image.  The trick is to store the css in a local file and refer to it in the html string like below:

<link href=”file://c:/Styles.css” rel=”stylesheet” type=”text/css” />

Then you can use htmlsnapshot to capture the html string into image with the CSS specified.

FAQ: How do I register the Audio record component?

Saturday, October 27th, 2007

How do I register the component?

Answer: Once you buy the component, a registration code will be sent to you by email. After creating an object instance of Active Audio Record in your favorite programming languages, calling the SetCode method with the code you got by email before recording. In this way, every limitation in trial mode will be removed.

‘Here is a quick example in VB Script:
Dim rec
‘Create the Audio Record Object

Set rec = CreateObject(“AudioCtl.AudioRecord.1″)
‘Set your code here

rec.SetCode “Your license code here”
‘Then do what ever you like …

Capture image in an existing webbrowser control

Monday, October 1st, 2007

Htmlsnapshot can capture image of an existing webbrowser control and save it into jpg, bmp, gif, png etc.

You need to pass the object instance of the webbrowser control (IDispatch in C++).

In VB6, you can do it like below:

     Dim snap1 As HtmlSnap2.CHtmlSnap
     Set snap1 = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
     snap1.SnapWebBrowser WebBrowser1.Object, “c:\web.bmp”
     snap1.Clear

We also provide C# demo with our trial version.

html to image 2.0.2007.901

Sunday, September 2nd, 2007

We just released a new version of html to image

It fixes an issue when capturing javascript enabled page such as the google map.

Record streaming audio in Vista

Saturday, August 25th, 2007

To record the “Stereo Mix” or “Wave Mix” on Vista with Audio Record Expert, you will need to enable the device first.

  1. Select sound from the control panel.
  2. Select the recording tab.
  3. Right click on the background of the tab and choose “show disabled devices.”
  4. Right click on Wave Out Mix and click enable.
  5. Now it should work the same way as Wave Out Mix in Windows XP, allowing you to record any sound your computer makes.

Read more on

http://www.downloadsquad.com/2007/01/15/how-to-enable-wave-out-recording-in-vista/