Home

SWF Scout

SWF Scout screenshot (click to enlarge)



SWF Scout ActiveX/NET library

Converting EMF to SWF (vector based EMF to SWF conversion)

SWF Scout library provides an extended support for Windows Metafiles (WMF) and Enhanced Windows Metafiles (EMF). Metafiles can be loaded and converted into a sprite for further use in generated flash movie. And what is more SWF Scout provides .HDC property that can be used as device context (DC) handle parameter in WinGDI/GDI+ functions.

For rendering complex EMF (for example, EMF from virtual printers) or complex drawings with complex gradients etc there are properties HDC_HighQuality and HDC_HighQuality_UseBuffer and HDC_AutoEmbeddedFonts (enable it to automatically embed fonts from used in EMF). Use of these properties slow downs EMF2SWF conversion process but you can get almost 99% equal result. This properties require additional "EMF2SWF HighQuality License"

To place all vector objects drawn on HDC using .HDC property as sprite into flash (SWF) movie .PlaceFromHDC() method should be used. This method creates and places the new sprite from objects that were drawn on HDC.

In this sample you learn how to convert EMF metafile into SWF flash movie using SWF Scout library.

To load the metafile we will use .PlayMetaFileToHDC() method that takes the filename of EMF file and plays it to DC of SWF Scout flash library. Then we will place the metafile to the flash movie as sprite using .PlaceFromHDC() method

Our sample EMF metafile was generated by virtual EMF printer from HTML document. You can download it here: PrintedHTML.emf (30 KB)

Here is VB Source code of Metafile.vbs script that takes PrintedHTML.emf metafile and converts into SWF flash movie: "SWFScout_emf_to_swf.SWF"

W = 640
H = 480
Set Movie = CreateObject("SWFScout.FlashMovie")
Movie.InitLibrary "demo", "demo"

Movie.BeginMovie 0,0,W,H,1,12,6
Movie.Compressed = true
Movie.SetBackgroundColor 255,255,255

Movie.HDC_HighQuality = true ' use of this property requires additional EMF2SWF License in registered version
Movie.HDC_HighQuality_UseBuffer = true
' use of this property requires additional EMF2SWF License in registered version
Movie.HDC_AutoEmbeddedFonts = true ' use of this property requires additional EMF2SWF License in registered version

Movie.PlayMetaFileToHDC "PrintedHTML.emf", 0,0,0.25,0.25
Movie.PlaceFromHDC Movie.CurrentMaxDepth

Movie.ShowFrame 1

Movie.EndMovie

Movie.SaveToFile "SWFScout_emf_to_swf.swf"

download ZIP with all required files and VB script: swfscout_emf_to_swf.zip

Generated flash movie (SWFScout_emf_to_swf.swf) below:


Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement