Getting Started in ASP.NETBytescout SWF To Video SDK

SWF To Video SDK can be used from ASP.NET. This sample for ASP.NET shows how to convert SWF into PNG image using SWF To Video SDK.

using System;
using System.IO;

using BytescoutSWFToVideo;

namespace SwfToPng
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String inputSwfFile = Server.MapPath("Shapes.swf");

            // Create an instance of SWFToVideo ActiveX object
            SWFToVideo converter = new SWFToVideo();

            // Set debug log
            //converter.SetLogFile("log.txt");

            // Register SWFToVideo
            converter.RegistrationName = "demo";
            converter.RegistrationKey = "demo";


            // Enable trasparency - set BEFORE setting SWF filename
            converter.RGBAMode = true;

            // set input SWF file
            converter.InputSWFFileName = inputSwfFile;


            // Select the frame to extract (20th)
            converter.StartFrame = 20;
            converter.StopFrame = 20;

            // Run conversion.
            // Empty parameter means conversion to binary stream instead of file.
            converter.ConvertToPNG("");

            // Display the extracted image:

            Response.Clear();
            // Add content type header 
            Response.ContentType = "image/png";
            // Set the content disposition 
            Response.AddHeader("Content-Disposition", "inline;filename=result.png");

            // Write the image bytes into the Response output stream 
            Response.BinaryWrite((byte[]) converter.BinaryImage);

            Response.End();
        }
    }
}