locked
Exporting whole web site as a PDF File RRS feed

  • Question

  • User41602489 posted

    Hi All,

    I have done small tricks for export pdf file but it make some problem in server just i did test in local. If you need pls try it once.

    1. You must have to download  wkhtmltopdf.exe from  http://code.google.com/p/wkhtmltopdf/

    2. Place it where ever you feel confortable for execution

    string myDocumentsPath = "c:\\wkhtmltopdf.exe ";

    ProcessStartInfo psi = new ProcessStartInfo(myDocumentsPath, " http://www.website.com/page  d:\\bb.pdf");
    psi.UseShellExecute = false;
    psi.RedirectStandardOutput = true;
    psi.RedirectStandardInput = true;
    psi.RedirectStandardError = true;
    psi.CreateNoWindow = true;
    Process myProcess = Process.Start(psi);
    myProcess.WaitForExit();
    myProcess.Close();

    Response.Clear();
    Response.AddHeader("content-disposition", "attachment;filename=abc.pdf");
    Response.ContentType = "application/pdf";
    Response.WriteFile("D:\\bb.pdf");
    Response.End();

    Enjoy it hope it help full to you 

    Thanks

    Khem

    Kathmandu,Nepal 

    Tuesday, October 27, 2009 12:55 AM

All replies