Esempio n. 1
0
        public ActionResult Index()
        {
            XPdf x = new XPdf();
            x.Path = @"c:\temp\pdf\";
            var html = @"<!DOCTYPE html>
            <html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
            <head>
            <meta charset='utf-8' />
            <title>Teste Hello World</title>
            </head>
            <body>
            Teste Hello World!!!
            </body>
            </html>";
            //html = "http://www.google.com";
            byte[] filestream = x.HtmlToPdf(html, "teste");

            Response.ClearContent();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "inline; filename=" + "teste.PDF");
            Response.AddHeader("Content-Length", filestream.Length.ToString());
            Response.BinaryWrite(filestream);
            Response.End();

            return View();
        }
Esempio n. 2
0
        public ActionResult Example2()
        {
            //Example 2
            XPdf x = new XPdf();
            x.Path = @"c:\temp\pdf\";

            if (!Directory.Exists(x.Path))
                Directory.CreateDirectory(x.Path);

            System.Security.Policy.Url html = new System.Security.Policy.Url("http://www.google.com");

            x.UrlToPdf(html, "teste");

            return View();
        }
Esempio n. 3
0
        public ActionResult Example1()
        {
            //Example
            XPdf x = new XPdf();
            x.Path = @"c:\temp\pdf\";

            if (!Directory.Exists(x.Path))
                Directory.CreateDirectory(x.Path);

            var html = @"<!DOCTYPE html>
            <html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
            <head>
            <meta charset='utf-8' />
            <title>Teste Hello World</title>
            </head>
            <body>
            Teste Hello World!!!
            </body>
            </html>";

            x.HtmlToPdf(html, "teste");

            return View();
        }