public virtual ActionResult ShowPDF(string par1, string par2, string par3) { //string url = string.Format("{0}/{1}/Home/Contrato?par1={2}&par2={3}&par3={4}", Request.Url.Authority, Request.ApplicationPath, par1, par2, par3); var urlAct = Url.Action("Contrato", "Home", new RouteValueDictionary(new { par1 = par1, par2 = par2, par3 = par3 })); var url = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Host, urlAct); try { //var pdf = PdfGenerator.GetPdfContractFromHtml(url); var pdf = PdfGenerator.Convert(new Uri(url), @"C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe"); if (pdf != null) { MemoryStream ms = new MemoryStream(pdf.ToArray()); FileStreamResult filestream = new FileStreamResult(ms, "application/pdf"); return(filestream); } else { return(RedirectToAction("Index")); } } catch (Exception ex) { throw new Exception("(" + url + ") - " + ex.ToString()); } }