Convert to HTML with advanced options

GroupDocs.Conversion provides MarkupConvertOptions 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
  • Zoom - specifies the zoom level in percentage. Default is 100
  • UsePdf - in some cases, 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

Following code snippet shows how to convert to HTML with advanced options

using (Converter converter = new Converter("sample.docx"))
{
    MarkupConvertOptions options = new MarkupConvertOptions
    {
        PageNumber = 2,
        PagesCount = 1,
        FixedLayout = true
    };
    converter.Convert("converted.html", options);
}

Control page borders visibility

The following code sample shows how to convert to Html and control page borders visibility

var source = "sample.docx";
using (var converter = new Converter(source))
{
    var options = new MarkupConvertOptions
    {
        FixedLayoutShowBorders = false
    };
    converter.Convert("converted.html" , options);
}

More resources

Advanced Usage Topics

To learn more about convert file features, please refer to the advanced usage section.

Examples and Demos

Please find more use-cases and complete C# sources of our backend and frontend examples and try them for free!