Skip to content

Instantly share code, notes, and snippets.

@groupdocs-cloud-gists
Last active April 16, 2025 00:22
Show Gist options
  • Save groupdocs-cloud-gists/267b23164d1c2a725b5d475a6b23d4c1 to your computer and use it in GitHub Desktop.
Save groupdocs-cloud-gists/267b23164d1c2a725b5d475a6b23d4c1 to your computer and use it in GitHub Desktop.
Convert DOC to HTML using Node.js

Develop Word DOC to HTML Converter


HTML is a versatile and web-friendly format. By converting Word documents to HTML using Node.js, content becomes easily accessible across browsers and devices. Learn how to convert DOC or DOCX to HTML using GroupDocs.Conversion Cloud SDK for Node.js. The conversion is performed using GroupDocs.Conversion Cloud SDK for Node.js.



For more details, please visit How to Convert Word Documents to HTML in Node.js.

doc to html

Important Links

Product Page | Docs | Live Demo | API Reference | Code Samples | Source Code | New Releases | Blog | Free Support | Free Trial

How to convert Word document to HTML file using Node.js API
// More examples over https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet
// Obtain your API credentials
string clientId = "XXXXXX-XXXXXXXXX-4088-9ca0-55c38f4b7f22";
string clientSecret1 = "XXXXXXXXXXXXXXXXXXXX";
// Create an instance of the Configuration class and initialize it with the Client ID & Client Secret
Configuration configuration = new Configuration(clientId, clientSecret);
// Define the API base URL to perform Word document to HTML conversion operation
configuration.setApiBaseUrl("https://api.groupdocs.cloud");
// Initialize an instance of ConvertApi with the Configuration object
ConvertApi convertApi = new ConvertApi(configuration);
ConvertSettings settings = new ConvertSettings();
settings.setStorageName("internal");
settings.setFilePath("input.doc");
settings.setFormat("HTML");
settings.setOutputPath("myResultant.html");
// Use ConvertDocument method to convert DOC to HTML file
ConvertDocumentRequest request = new ConvertDocumentRequest(settings);
List<StoredConvertedResult> response = convertApi.convertDocument(request);
// Check the response and print success message
if (response != null && response.equals("OK")) {
System.out.println("Conversion successful! Resultant HTML file is saved at: " + response.getFilePath());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment