Convert to HTML with advanced options

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Conversion MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-conversion -- dnx GroupDocs.Conversion.Mcp --yes
Folders, licensing and more →

GroupDocs.Conversion provides MarkupConvertOptions to give you control over conversion result. The following options could be set:

  • setFixedLayout controls the HTML generation. If it’s set to true, fixed layout will be used e.g. absolutely positioned HTML element.
  • setZoom specifies the zoom level in percentage. The default value is 100.
  • setUsePdf. 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.

The following code snippet shows how to convert to HTML with advanced options:

const loadOptions = new groupdocs.conversion.WordProcessingLoadOptions()
loadOptions.setPassword("12345");

const converter = new groupdocs.conversion.Converter('sample.docx', loadOptions)
const convertOptions = new groupdocs.conversion.MarkupConvertOptions();
convertOptions.setPageNumber(2);
convertOptions.setFixedLayout(true);
convertOptions.setPagesCount(1);

converter.convert("converted.html", convertOptions);