コード例 #1
0
 //public IActionResult Download([FromBody] List<DocumentoPagi> documentoPagi)
 public IActionResult Download([FromBody] string arc_cod)
 {
     try
     {
         PrintPDF     print = new PrintPDF();
         Alfanumerico _alf  = new Alfanumerico();
         //Stream stream = new MemoryStream(print.GeneratePdfPagSelect(documentoPagi));
         Stream stream = new MemoryStream(print.GeneratePdfPagSelect(arc_cod));
         if (stream == null)
         {
             return(NotFound()); // returns a NotFoundResult with Status404NotFound response.
         }
         var nombre = _alf.CrearAlfaNumerico(10);
         return(File(stream, "application/pdf", nombre + ".pdf")); // returns a FileStreamResult
     }
     catch (Exception ex)
     {
         return(NotFound(new NotFoundError(ex.Message)));
     }
 }