Convert MHT, HTML to PDF (PDF/A)

Q: We are evaluating your product PDFNer SDK. First step we need to
convert multiple files to PDF, then merge them, add some text and
bookmarks and finaly save it in PDF/A.

Main documents that needs to be converted are in .MHT format. I
noticed, all your examples have commented line with mht conversion.

I tested the conversion but it failed with an error:
   An error occurred while converting the file.
   Unable to convert file, too many attempts.

if (pdftron.PDF.Convert.RequiresPrinter(file)) {
  listBox1.Items.Add("Printing file: " + file);
pdftron.PDF.Convert.ToPdf(pdfdoc, file); <-- Error here

Does PDFTron support conversion of mht files?

A: The optimal way to convert HTML to PDF using PDFNet is using
‘pdftron.PDF.HTML2PDF’ - as shown in Html2Pdf sample:

Unfortunately ‘pdftron.PDF.HTML2PDF’ does not offer direct support
MHT. You could convert MTH files to PDF using 'pdftron.PDF.ToPdf' with
the help of MS Office. For this you would need to install MS Office
2010 (or 2007 + SP2) on a given machine. Please note that if MS Office
is installed, you do not need to check/install/use a virtual printer

To merge PDF document you can use pdfdoc.InsertPages() as show in the
following snippets:

// Split a PDF document into multiple pages ...
using (PDFDoc in_doc = new PDFDoc("in.pdf")) {
    int page_num = in_doc.GetPageCount();
    for (int i = 1; i <= page_num; ++i) {
        using (PDFDoc new_doc = new PDFDoc()) {
            new_doc.InsertPages(0, in_doc, i, i,
            new_doc.Save("in_" + i + ".pdf",

// Merge several PDF documents into one ...
using (PDFDoc new_doc = new PDFDoc()) {
    for (int i = 1; i <= doc_count; ++i) {
        using (PDFDoc in_doc = new PDFDoc("in_" + i + ".pdf")) {
            new_doc.InsertPages(0, in_doc, 1, in_doc.GetPageCount(),
    new_doc.Save("merged.pdf", SDFDoc.SaveOptions.e_remove_unused);

You could add/edit stamps and bookmarks as shown in Stamper and
Bookmarks samples respectively:

To save document to PDF/A you would use pdftron.PDF.PDFACompliance add-
on as shown in PDF/A Test sample project: