Product Family

Merge MHT to PDF via C++

Sample code for concatenation MHT documents into single formats PDF on C++. Programmers can use this example code to placing MHT into PDF with VC++, GNU C++ in kinds of application.

Merge MHT to PDF Using C++

In order to merge MHT to PDF, we’ll use Aspose.PDF for C++ API which is a feature-rich, powerful and easy-to-use document manipulation and concatenation API for C++ platform. Open NuGet package manager, search for Aspose.PDF and install.

Package Manager Console Command

PM> Install-Package Aspose.PDF.Cpp


How to merge MHT to PDF via C++

C++ developers can easily load & merge MHT files to PDF in just a few lines of code.

<% ld-json %>

System Requirements

Aspose.PDF for C++is supported on all major operating systems. Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit, and Linux 64 bit.
  • Development environment like Microsoft Visual Studio.
  • Aspose.PDF for C++ DLL referenced in your project.

This sample code shows MHT to PDF C++ concatenation

    String pathSource1 = u"../../TestData/test.mht";
	String pathSource2 = u"../../TestData/Second/test.mht";
	// mht files can be parsed and loaded as Aspose Document
	System::SharedPtr<Document> firstDoc = MakeObject<Document>(pathSource1, MakeObject<MhtLoadOptions>());
	auto secondDoc = MakeObject<Document>(pathSource2, MakeObject<MhtLoadOptions>());
	// create empty pdf document
	auto outputDoc = MakeObject<Document>();
	// set less memory usage with unload instead of fast performance
	for (auto const& page : firstDoc->get_Pages())
		// add page from one document to another directly
	for (auto const& page : secondDoc->get_Pages())
		// add page from one document to another directly
	// save result pdf to file
	outputDoc->Save(u"Merger_mht_pdf.pdf", SaveFormat::Pdf);

Combine MHT to PDF in C++

Convert or combine multiple MHT into single PDF file in C++ is not straightforward task without using 3rd party library. This page shows how to merge multiple MHT files into a single PDF document using Aspose.PDF for C++. The example is written in Python but the API can be used in other programming languages. PDF files are merged such that the first one is joined at the end of the other document.

Package Manager Console Command

                                PM> Install-Package Aspose.PDF.Cpp

About Aspose.PDF for .NET API

A PDF Processing Library to create cross-platform applications with the ability to generate, modify, merge, render, secure and print documents without using Adobe Acrobat. It supports merging various file formats into PDF including HTML and merging PDF documents into various output formats. Developers can easily render all HTML content in a single Page PDF as well as merge HTML files with SVG graphic tags to Tagged PDF files. .NET PDF API offers compression, table creation, graph & image functions, hyperlinks, stamp and watermarking tasks, extended security controls & custom font handling.
  • Merge MHT to PDF via Online App