Exemple #1
0
        public void GenerarPDF2(HttpContext obj)
        {
            string DocumentoId = "";

            DocumentoId = obj.Request.Params["DocumentoId"];
            DocumentoId = DocumentoId.Replace(".pdf", "");
            if (DocumentoId != null)
            {
                //return Convert.ToBase64String(BLLAlumnoInscrito.TraerDocumento(int.Parse(DocumentoId)));
                Stream stream       = new MemoryStream(BLLAlumnoInscrito.TraerDocumento(int.Parse(DocumentoId)));
                var    MemoryStream = new MemoryStream();
                stream.CopyTo(MemoryStream);

                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.ContentType = "application/pdf";
                HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
                HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=" + "Beca" + ".pdf");

                HttpContext.Current.Response.BinaryWrite(MemoryStream.ToArray());
                //HttpContext.Current.Response.ContentType = "application/pdf";
                //HttpContext.Current.Response.AddHeader("content-disposition", MemoryStream.Length.ToString());
                MemoryStream.Close();
                HttpContext.Current.Response.Flush();

                HttpContext.Current.Response.End();
            }
        }
Exemple #2
0
        public string GenerarPDF(string DocumentoId)
        {
            byte[] Archivo = BLLAlumnoInscrito.TraerDocumento(int.Parse(DocumentoId));
            string nombre  = Herramientas.ConvertidorT.CrearPass() + ".pdf";

            System.IO.File.WriteAllBytes("C:\\inetpub\\wwwroot\\Archivos\\" + nombre, Archivo);
            return("\\Archivos\\" + nombre);
        }
Exemple #3
0
        public void GenerarPDF2(string DocumentoId)
        {
            Stream stream       = new MemoryStream(BLLAlumnoInscrito.TraerDocumento(int.Parse(DocumentoId)));
            var    MemoryStream = new MemoryStream();

            stream.CopyTo(MemoryStream);

            HttpContext.Current.Response.Expires = 0;
            HttpContext.Current.Response.Buffer  = true;
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");
            HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=" + "Beca" + ".pdf");
            HttpContext.Current.Response.BinaryWrite(MemoryStream.ToArray());
            HttpContext.Current.Response.Flush();
            MemoryStream.Close();
            HttpContext.Current.Response.End();
        }