GroupDocs.Conversion provides WebConvertOptions to give you control over conversion result. The following options could be set:
FixedLayout controls the HTML generation. If it’s set to true, fixed layout will be used e.g. absolutely positioned HTML element.
FixedLayoutShowBorders controls the display of page borders during fixed layout conversion. Default is true.
EmbedFontResources specifies whether to embed font resources within the main HTML. Default is false. Note: fonts automatically embed when FixedLayout is enabled.
Zoom specifies the zoom level in percentage. The default value is 100.
UsePdf. Sometimes, for better rendering and elements positioning the source document should be converted to PDF first. If this property is set to true, the input firstly is converted to PDF and after that to desired format.
SlideShow converts a presentation to a single HTML file that plays as a slideshow, with slide transitions and shape animations. Default is false. See Convert a presentation to an HTML slideshow.
The following code snippet shows how to convert to HTML with advanced options
Control whether font resources are embedded within the HTML file when converting a document to flow-layout HTML:
using(Converterconverter=newConverter("sample.docx")){WebConvertOptionsoptions=newWebConvertOptions{FixedLayout=false,EmbedFontResources=true// Embed fonts directly in HTML};converter.Convert("embedded-fonts.html",options);}
When EmbedFontResources is set to true, the font data is embedded directly within the HTML file as base64, making it self-contained but larger in size. When it is set to false (default), no font data is exported and the browser renders the text with fonts installed on the viewer’s system.
Note: When FixedLayout is enabled (the default), fonts are automatically embedded regardless of the EmbedFontResources setting.
Control page borders visibility
The following code snippet shows how to convert to HTML and control page borders visibility
Set SlideShow to true to convert a presentation to a single HTML file that plays as a slideshow, with slide transitions and shape animations. Every asset from the deck is inlined into that one file, so no side files or temporary folders are produced.
The property defaults to false, so existing presentation-to-HTML conversions are unchanged.
The following resources are inlined into the HTML as data URIs:
fonts embedded in the deck, converted to TrueType;
images, including rasterized metafiles;
audio and video;
all CSS and the slideshow JavaScript.
Warning
jQuery and anime.js, which drive navigation and the animations, are loaded from a CDN. The page needs an internet connection to animate and navigate between slides. The slide content itself renders offline.
Unsupported combinations
Setting SlideShow together with any of the following options throws InvalidConvertOptionsException before conversion starts, rather than silently ignoring one of the two settings:
Combination
Reason
UsePdf = true
Converting through PDF discards the slideshow
Format is MHT or MHTML
Only HTML and HTM output is supported
Watermark is set
Watermarks are not supported for slideshows
Zoom other than 100
Zoom is not supported for slideshows
Saving page by page is not supported either. A slideshow is one navigable document, so the Convert overloads that save each page to a separate stream throw NotSupportedException.