HTML5Point SDK - Codes

The Only PPT to HTML5 SDK in the industry that support Animations, Transitions & Effects

Convert PowerPoint Presentation to HTML5 Online
Select File
X

Note: Please make sure that powerPoint 2010 or later is installed in your machine

Windows Service

To know about creating Windows Service application, please download the documentation from the following link : https://www.digitalofficepro.com/resources/WindowsService.pdf

MVC application

To know about creating and deploying MVC application, please download the documentation from the following link : https://www.digitalofficepro.com/resources/Develop_and_Deploy_MVC4_App_Pack_on_iis.pdf

Webcast Demo

To view the Webcast Demo : Click Here

C# Code

using System;

using DigitalOfficePro.Html5PointSdk;

 

namespace Html5Converter

{

class Program

{

static void Main(string[] args)

{

//To check args length

if (args.Length != 2)

{

Console.WriteLine("Html5Point SDK C# sample.\n");

Console.WriteLine("Usage:\n");

Console.WriteLine("Html5Converter.exe <input-ppt-file-name> <output-HTML5-file-name>\n");

return ;

}

 

//Create powerpoint to html5 converter object.

PresentationConverter presentationConverter = new PresentationConverter();

//Initialize library using userName and productKey in case of redistributable license.

//presentationConverter.InitLibrary("userName", "productKey");

 

 

//Update conversion settings

presentationConverter.Settings.CreateDirectoryForOutput = true;

 

//Output settings

presentationConverter.Settings.Output.AdvanceOnMouseClick = true;

presentationConverter.Settings.Output.BackgroundColor = -16777216;//ARGB of black.

presentationConverter.Settings.Output.EmbedFonts = true;

presentationConverter.Settings.Output.FitToWindow = true;

presentationConverter.Settings.Output.IncludeHiddenSlides = true;

presentationConverter.Settings.Output.WindowScale = 100;

 

//For LMS output

//presentationConverter.Settings.Lms = new LmsSettings();

//presentationConverter.Settings.Lms.LmsType = LmsType.Scorm1Point2;

//presentationConverter.Settings.Lms.CourseTitle = "Sample course title";

//presentationConverter.Settings.Lms.Description = "Sample description";

 

//For thumbnail generation

presentationConverter.Settings.Thumbnail = new ThumbnailSettings();

presentationConverter.Settings.Thumbnail.Format = ThumbnailImageFormat.Jpg;

presentationConverter.Settings.Thumbnail.Scale = 10;

 

//To add company logo

//presentationConverter.Settings.Logo = new LogoSettings();

//presentationConverter.Settings.Logo.Left = 10;

//presentationConverter.Settings.Logo.Top = 10;

//presentationConverter.Settings.Logo.Width = 200;

//presentationConverter.Settings.Logo.Height = 100;

//presentationConverter.Settings.Logo.Hyperlink = "http://www.digitalofficepro.com";

//presentationConverter.Settings.Logo.ImagePath = @"C:\Users\user\Documents\Logo.png";

 

//For custom player

//presentationConverter.Settings.Player = new PlayerSettings();

//presentationConverter.Settings.Player.Path =@"C:\Program Files (x86)\DigitalOfficePro\HTML5PointSDK\Players\classic";

 

//Open persenattion

string presentationName = args[0];

presentationConverter.OpenPresentation(presentationName);

Console.WriteLine("PowerPoint presentation '{0}' is opened.", presentationName);

string outputHtmlFile = args[1];

 

//HTML5 conversion

presentationConverter.Convert(outputHtmlFile);

Console.WriteLine("Converted presentation '{0}' to '{1}'.", presentationName, outputHtmlFile);

presentationConverter.ClosePresentation();

Console.WriteLine("Presentation closed");

 

}

}

}

VB.net Code

Imports DigitalOfficePro.Html5PointSdk

 

Module Module1

Sub Main(ByVal args As String())

'To check args length

If args.Length <> 2 Then

Console.WriteLine("Html5Point SDK C# sample." & vbLf)

Console.WriteLine("Usage:" & vbLf)

Console.WriteLine("Html5Converter.exe <input-ppt-file-name> <output-HTML5-file-name>" & vbLf)

Return

End If

 

'Create powerpoint to html5 converter object.

Dim presentationConverter As New PresentationConverter()

'Initialize library using userName and productKey in case of redistributable license.

'presentationConverter.InitLibrary("userName", "productKey");

 

 

'Update conversion settings

presentationConverter.Settings.CreateDirectoryForOutput = True

 

'Output settings

presentationConverter.Settings.Output.AdvanceOnMouseClick = True

presentationConverter.Settings.Output.BackgroundColor = -16777216 'ARGB of black.

presentationConverter.Settings.Output.EmbedFonts = True

presentationConverter.Settings.Output.FitToWindow = True

presentationConverter.Settings.Output.IncludeHiddenSlides = True

presentationConverter.Settings.Output.WindowScale = 100

 

'For LMS output

'presentationConverter.Settings.Lms = new LmsSettings();

'presentationConverter.Settings.Lms.LmsType = LmsType.Scorm1Point2;

'presentationConverter.Settings.Lms.CourseTitle = "Sample course title";

'presentationConverter.Settings.Lms.Description = "Sample description";

 

'For thumbnail generation

presentationConverter.Settings.Thumbnail = New ThumbnailSettings()

presentationConverter.Settings.Thumbnail.Format = ThumbnailImageFormat.Jpg

presentationConverter.Settings.Thumbnail.Scale = 10

 

'To add company logo

'presentationConverter.Settings.Logo = new LogoSettings();

'presentationConverter.Settings.Logo.Left = 10;

'presentationConverter.Settings.Logo.Top = 10;

'presentationConverter.Settings.Logo.Width = 200;

'presentationConverter.Settings.Logo.Height = 100;

'presentationConverter.Settings.Logo.Hyperlink = "http://www.digitalofficepro.com";

'presentationConverter.Settings.Logo.ImagePath = @"C:\Users\user\Documents\Logo.png";

 

'For custom player

'presentationConverter.Settings.Player = new PlayerSettings();

'presentationConverter.Settings.Player.Path =@"C:\Program Files (x86)\DigitalOfficePro\HTML5PointSDK\Players\classic";

 

'Open persenattion

Dim presentationName As String = args(0)

presentationConverter.OpenPresentation(presentationName)

Console.WriteLine("PowerPoint presentation '{0}' is opened.", presentationName)

Dim outputHtmlFile As String = args(1)

 

'HTML5 conversion

presentationConverter.Convert(outputHtmlFile)

Console.WriteLine("Converted presentation '{0}' to '{1}'.", presentationName, outputHtmlFile)

presentationConverter.ClosePresentation()

Console.WriteLine("Presentation closed")

 

End Sub

End Module

 

 

C++ Code

#include "stdafx.h"

#import "..\..\..\..\Include\DigitalOfficePro.Html5PointSdk.tlb" named_guids

 

int _tmain(int argc, _TCHAR* argv[])

{

if (argc != 3)

{

wprintf(L"Html5Point SDK C++ sample.\n");

wprintf(L"Usage:\n");

wprintf(L" Simple_Cpp.exe <input-ppt-file-name> <output-HTML5-file-name>\n");

return 0;

}

bool initialized= SUCCEEDED(CoInitialize(NULL));

 

CComQIPtr<DigitalOfficePro_Html5PointSdk::IPresentationConverter> pConverter;

 

HRESULT hr = pConverter.CoCreateInstance(__uuidof(DigitalOfficePro_Html5PointSdk::PresentationConverter));

if (FAILED(hr))

{

wprintf(L"Html5Point SDK is not installed.\n");

return 1;

}

pConverter->Settings->CreateDirectoryForOutput = true;

 

wprintf(L"Opening the presentation %s\n", argv[1]);

hr = pConverter->OpenPresentation(argv[1]);

if (FAILED(hr))

{

_bstr_t errorDescription = pConverter->LastErrorDescription;

wprintf(L"Can't open the presentation %s.\nError description is:%s\n", argv[1], errorDescription);

return 3;

}

 

wprintf(L"Converting to HTML5 file %s\n", argv[2]);

hr = pConverter->Convert(argv[2]);

if (FAILED(hr))

{

_bstr_t errorDescription = pConverter->LastErrorDescription;

wprintf(L"Can't generate html5 file %s.\nError description is:%s\n", argv[2], errorDescription);

return 4;

}

 

hr = pConverter->ClosePresentation();

if (FAILED(hr))

{

_bstr_t errorDescription = pConverter->LastErrorDescription;

wprintf(L"Can't close presentation.\nError description is:%s\n",errorDescription);

return 5;

}

 

wprintf(L"Done\n");

if(initialized)

CoUninitialize();

return 0;

}

PHP Code

You can use the class DOTNET to create the SDK object and call conversion.

Try the following sample.

//***********************************************************************************************************

$objPresentationConverter = new DOTNET( "DigitalOfficePro.Html5PointSdk, Version=1.2.8.2, Culture=neutral, PublicKeyToken=5e90c5baa3624fc1", "DigitalOfficePro.Html5PointSdk.PresentationConverter");

$presentationPath = "C:\Test\input.pptx";
$outputPath = "C:\Test\output.html";

$objPresentationConverter -> OpenPresentation($presentationPath);
$objPresentationConverter -> Convert($outputPath);
$objPresentationConverter -> ClosePresentation();

//***********************************************************************************************************

You should change the value of "Version" with version of SDK dll (C:\Program Files (x86)\DigitalOfficePro\HTML5PointSDK\Include\DigitalOfficePro.Html5PointSdk.dll) and "PublicKeyToken" value with PublicKeyToken of same dll (C:\Program Files (x86)\DigitalOfficePro\HTML5PointSDK\Include\DigitalOfficePro.Html5PointSdk.dll).

$objPresentationConverter = new DOTNET( "DigitalOfficePro.Html5PointSdk, Version=, Culture=neutral, PublicKeyToken=", "DigitalOfficePro.Html5PointSdk.PresentationConverter");

Python Code

// Python sample ///////////////////////////////
// we need to install ironPython for using .net SDK components in Python
******************************************************************************

1. To download and install ironPython Click Here.
2. Start python by clicking ipy.exe from ironPython install folder.
3. Copy following code into python interface.

#simple python converter

import clr
clr.AddReference("DigitalOfficePro.HTML5PointSDK") #before calling the following function copy DigitalOfficePro.Html5PointSDK.dll to %ironPythos installpath%/Dlls
#clr.AddReferenceToFile("DigitalOfficePro.Html5PointSDK.dll")

from DigitalOfficePro import*
import DigitalOfficePro
import DigitalOfficePro.Html5PointSdk
from DigitalOfficePro.Html5PointSdk import *
converter = PresentationConverter()
converter.OpenPresentation("e:\\test.pptx")
converter.Convert("e:\\test.html")