Q:

Convert HTML to PS with Ghostscript C#

I have problem when i print html file, i have tried doc,xls, and txt files and they work perfectly, but when i give the html file it shows me the print dialog and i have to select the ghostscript printer in order to work.
My code is:
    [DllImport("Winspool.drv")]
    private static extern bool SetDefaultPrinter(string printerName);

    [ValidateInput(false)]
    public ActionResult CreatePdf(string file , string html)
    {
        SetDefaultPrinter("Ghostscript");
        Process process1 = new Process();
        if (html != null && html != "")
        { process1.StartInfo.FileName = "example.html"; }
        else
        { process1.StartInfo.FileName = file; }
        process1.EnableRaisingEvents = true;
        process1.StartInfo.Verb = "print";
        process1.StartInfo.Arguments = "\"Ghostscript PDF\"";
        process1.StartInfo.WorkingDirectory = Server.MapPath("~" + "/Export");
        process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        process1.StartInfo.CreateNoWindow = true;
        process1.Start();
        try
        {
            process1.WaitForExit();
        }
        catch (InvalidOperationException) { }
        process1.Dispose();
    }

This should change my output.ps file,which then i use to make the pdf file,that works perfectly i just need to make this work for html file.
I followed this 2 examples:
Example 1
Example 2
Edit:
I needed this converstion in order to get pdf file from the html, and found that wkhtmltopdf suits me best.

A:

Ghostscript does not convert (layout and render) HTML documents to PDF or PostScript, it is just a library for working with PostScript and PDF files, such as creating them from scratch and converting PostScript files to a raster format.
If you want to convert HTML to PDF your best bet is to use a commercial library like PrinceXML, or host WebKit.
When your code works, it works by getting Internet Explorer (or whatever your shell-default web-browser is) to do the rendering and printing itself. This technique will not reliably work in a server-side environment.

