//public byte[] GeneratePdfPagSelect(List<DocumentoPagi> documentoPagis) public byte[] GeneratePdfPagSelect(string arc_cod) { Byte[] bytes = null; try { DocumentoPagi ds = new DocumentoPagi(); var documentoPagis = ds.ObtenerPaginas(arc_cod); Document document = new Document(PageSize.A4, 10f, 10f, 20f, 20f); using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream()) { PdfWriter writer = PdfWriter.GetInstance(document, memoryStream); document.Open(); foreach (var pagina in documentoPagis) { Image img = Image.GetInstance(pagina.urlPagi); Rectangle dimensiones_multi = new Rectangle(img.Width, img.Height); document.SetPageSize(dimensiones_multi); document.NewPage(); document.Add(img); } //Addtional Information document.Close(); bytes = memoryStream.ToArray(); memoryStream.Close(); } return(bytes); } catch (Exception) { return(bytes); } }
public async Task <ActionResult <List <DocumentoPagi> > > Get([FromHeader] string arc_cod) { try { DocumentoPagi ds = new DocumentoPagi(); return(ds.ObtenerPaginas(arc_cod)); } catch (Exception ex) { return(NotFound(new NotFoundError(ex.Message))); } }