Create Flash From Power-Point in C#


Introduction:

In this article we will learn how to convert PowerPoint slides to a Flash movie.

Background:

Today we use Flash content extensively for our website design. We can develop such content using Flash technologies also but if we obtain our powerpoint slides as Flash then we can develop our Flash as we wish.

To do this I'm using iSpring SDK which will convert our PowerPoint slides to Flash. Before starting our work just download iSpring SDK and install it. Spring SDK is a high performance solution providing web sites and online applications with automatic PowerPoint to Flash conversion facilities. It is optimized for multithreaded processing and performs a fast batch conversion of thousands of PowerPoint presentations into compact and web-friendly Flash movies. For converting our PowerPoint to Flash follow the step given bellow.

Precaution Before Installing iSpring Setup:

  1. Close all IDE ex.(Visual Studio, C ++ IDE etc…).
  2. Install Flash player.
  3. Now start installing iSpring.

Step 1:

Create a new Windows Form Application using C#. Add a reference to the iSpring Object Library 5.0 from the COM tab and design the form like below.

ppttoflash.jpg

Step 2:

Import the namespace iSpring. In the global declaration section of our application, declare variables for assigning values in various events of our form option.

string _inputfile, _outputfile, _licensename, _audiofile, _password;
        bool _zipoutput, _exeoutput, _fullscreenmode, _flashmenu, _printing, _raster, _smartprocess, _savechart, _pwd, _resolution;
        int _width, _height, _screenwidth, _screenheight, _swfversion;
        string _backgroundcolor;

Maximum values are collected in bool and string as well as int and these values are collected from the checkbox_CheckChanged and textbox_TextChanged events of our form option. I'll not explain each and every event here but in the attachment you can find all the options.

Step 3:

iSpring provides various types of flash creation ex. Solid Presentation, Compound Presentation, Stand Alone Presentation etc... With respect to the selected presentation we have given a different selection option through RadioButtons. Now write the following code for the Convert button Click event to convert the PowerPoint slides to a Flash movie.

private void btnconvert_Click(object sender, EventArgs e)
        {
            PresentationConverter converter = new PresentationConverter();

            try
            {
                if (_inputfile != "" && _outputfile != "")
                {
                    converter.OpenPresentation(_inputfile);
                    converter.LicenseName = _licensename;
                    converter.Presentation.SlideWidth = _width;
                    converter.Presentation.SlideHeight = _height;
                    converter.Settings.ZipOutput = _zipoutput;
                    converter.Settings.GenerateExe = _exeoutput;
                    //converter.Settings.Appearance.BackgroundColor = Convert.ToUInt32(_backgroundcolor);
                    converter.Settings.Appearance.OptimizeImagesForScreenResolution = _resolution;
                    if (_resolution == true)
                    {
                        converter.Settings.Appearance.ScreenWidth = _screenwidth;
                        converter.Settings.Appearance.ScreenHeight = _screenheight;
                    }
                    else
                    {
                        converter.Settings.Appearance.ScreenWidth = 1024;
                        converter.Settings.Appearance.ScreenHeight = 740;
                    }
                    converter.Settings.Appearance.FullScreen = _fullscreenmode;
                    converter.Settings.Appearance.DisableMenu = _flashmenu;
                    converter.Settings.Appearance.DisablePrinting = _printing;
                    converter.Settings.SwfVersion = _swfversion;
                    if (rbdjpegpng.Checked == true)
                    {
                        converter.Settings.Media.ImageQuality = 0;
                        converter.Settings.Media.JpegImageQuality = 75;
                        converter.Settings.Media.GifImageQuality = 75;
                    }
                    else if (rbdpngonly.Checked == true)
                    {
                        converter.Settings.Media.ImageQuality = 0;
                        converter.Settings.Media.GifImageQuality = 75;
 
                    }
                    converter.Settings.Media.RasterizeChartsAndGraphs = _raster;
                    converter.Settings.Media.AdvancedSmartArtProcessing = _smartprocess;
                    converter.Settings.Media.SaveSmartArtObjectsAsPNG = _savechart;
                    if (_audiofile != null)
                    {
                        converter.Presentation.BackgroundAudio.SourceFile = _audiofile;
                    }
                    if (_pwd == true)
                    {
                        converter.Settings.Protection.AllowDomain = _password;
 
                    }
                          // For solid presentation
                    if (rbdsolid.Checked)
                    {
                        converter.GenerateSolidPresentation(_outputfile +
                        "Presentation.exe", "", "");
                        MessageBox.Show("File Conversion Done");

                    }
                                    //For compound Presentation
                    else if (rbdcompound.Checked)
                    {
                        converter.GenerateCompoundPresentation(_outputfile + "Presentation.exe", "nullskin", "");
                        MessageBox.Show("File Conversion Done");
                    }
                                    // For Stand Alone Presentation.
                    else if (rbdstandalone.Checked)
                    {
                        converter.GenerateStandaloneSlides(_outputfile + "Presentation", "slide", "");
                        MessageBox.Show("File Conversion Done");
                    }
                                    // For Thumbnails only.
                    else if (rbdthumbnails.Checked)
                    {
                        converter.Presentation.Slides.SaveThumbnails(_outputfile + "Presentation", "thumb",
ImageFileType.IFT_JPG, 720, 540, 75);
                        MessageBox.Show("File Conversion Done");
                    }
                    else
                    {
                        MessageBox.Show("Select Convertion Type");
                    }

                }
                else
                {
                    MessageBox.Show("Select File");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error\n Ensure Input File & Output Files Are Specified\n" + ex.Message.ToString());
            }
        }
 
        private void btnclose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }

Conclusion:

Using the iSpring API, we can create Flash movies from our PowerPoint presentations.
 

Up Next
    Ebook Download
    View all
    Learn
    View all