Merge HTML

HTML (Hyper Text Markup Language) is the extension for web pages created for display in browsers. Known as language of the web, HTML has evolved with requirements of new information requirements to be displayed as part of web pages. The latest variant is known as HTML 5 that gives a lot of flexibility for working with the language. HTML pages are either received from server, where these are hosted, or can be loaded from local system as well.

How to merge HTML files programmatically

When you need to merge multiple HTML pages into a single file you can do this with help of GroupDocs.Merger and all content like text, images, tables, graphs, forms etc. will be preserved.

The following in an example of how to merge HTML files programmatically:

  • Create an instance of Merger class and pass source HTML file path as a constructor parameter. You may specify absolute or relative file path as per your requirements.
  • Add another HTML file to merge with join method. Repeat this step for other HTML documents you want to merge.
  • Call Merger class save method and specify the filename for the merged HTML file as parameter.
const merger = new groupdocs.merger.Merger('c:/sample1.html');
merger.join('c:/sample2.html');
merger.save('c:/merged.html');

Code Examples

Please find more use-cases and complete Node.js via Java sources of our backend and frontend examples and try them for free!

Merge HTML Live Demo

GroupDocs.Merger for Node.js via Java provides an online HTML Merger App, which allows you to try it for free and check its quality and accuracy.