SDK Codes
HTML5 SDK Codes
HTML5Point is a comprehensive and efficient conversion tool that helps you to easily convert professional looking PowerPoint presentations to HTML5 slideshows. Check out the following sample codes.
C# Code
usingSystem;
usingDigitalOfficePro.Html5PointSdk;
namespaceHtml5Converter
{
classProgram
{
staticvoidMain(string[]args)
{
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; } PresentationConverterpresentationConverter=newPresentationConverter(); of redistributable license. "productKey"); presentationConverter.Settings.CreateDirectoryForOutput=!0; presentationConverter.Settings.Output.AdvanceOnMouseClick=!0; presentationConverter.Settings.Output.BackgroundColor=-16777216; presentationConverter.Settings.Output.EmbedFonts=!0; presentationConverter.Settings.Output.FitToWindow=!0; presentationConverter.Settings.Output.IncludeHiddenSlides=!0; presentationConverter.Settings.Output.WindowScale=100; LmsType.Scorm1Point2; "Sample course title"; "Sample description"; presentationConverter.Settings.Thumbnail=newThumbnailSettings(); presentationConverter.Settings.Thumbnail.Format=ThumbnailImageFormat.Jpg; presentationConverter.Settings.Thumbnail.Scale=10; "https://www.digitalofficepro.com"; @"C:\Users\user\Documents\Logo.png"; PlayerSettings(); =@"C:\Program Files (x86)\DigitalOfficePro\HTML5PointSDK\Players\classic"; stringpresentationName=args[0]; presentationConverter.OpenPresentation(presentationName); Console.WriteLine("PowerPoint presentation '{0}' is opened.",presentationName); stringoutputHtmlFile=args[1]; 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="https://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=
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")