tags:

views:

143

answers:

3

Hi, We would like to programmatically print MHT document using .NET and any available IE DLLs or any other document viewer. We also would like to limit this print to 1st page of the document. If there are multiple frames inside MHT file, we would like to the print to show as it appears in Web page. Appreciate any throughts around this.

Thanks

A: 

Hi, We are able to configure Universal Document Coverter as default printer, and invoke a print using IE object as shown in below code. However, MHT documents having multiple frames is ending up generating multiple images for each frame. We also need to limit this print to 1st page of the document. Appreciate any thoughts on using any other IE DLLs available which can be used to avoid multiple frame issue and limiting the print to 1st page of the document.

using System;
using System.Collections.Generic;
using System.Text;
using SHDocVw;
using System.Threading;

namespace htmconverter
{
    class Program
    {
        static void Main(string[] args)
        {
            object missingValue = Type.Missing;
            InternetExplorer iexp = new InternetExplorer();
            iexp.Navigate("file://c:/c.mht", ref missingValue, ref missingValue, ref missingValue, ref missingValue);
            // while(OLECMDID.OLECMDID_PRINT!=OLECMDF.OLECMDF_SUPPORTED)
            iexp.ExecWB(OLECMDID.OLECMDID_PRINT, OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, ref missingValue, ref missingValue);
            Thread.Sleep(2000);


        }
    }
}
stranger001
A: 

Hi, Appreciate any suggestions.

stranger001
A: 

Appreciate any thoughts please.

stranger001