public IHttpActionResult GenerarPDF([FromBody] parametros model)
        {
            var arr = makePDF(model.contenidohtml);
            HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);

            result.Content = new ByteArrayContent(arr);
            result.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
            {
                FileName = "test.pdf"
            };
            result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

            var response = ResponseMessage(result);

            return(response);
        }
Exemple #2
0
        public FileStreamResult ConvertirHTMLToPDF(parametros modelo)
        {
            var arr = new HtmlToPDFController().makePDF(modelo.contenidohtml);

            System.Net.Http.HttpResponseMessage result = new System.Net.Http.HttpResponseMessage(HttpStatusCode.OK);
            result.Content = new System.Net.Http.ByteArrayContent(arr);
            result.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
            {
                FileName = "test.pdf"
            };
            result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

            MemoryStream m = new MemoryStream(arr);

            m.Position = 0;

            return(File(m, "application/pdf"));
        }
Exemple #3
0
        public ActionResult ConvertirHTMLToPDF()
        {
            var modelo = new parametros();

            return(View(modelo));
        }