public byte[] ObtenerTicket(long idTicket) { string NameConventions = string.Format("C:\\Windows\\Temp\\Ticket_{0}.pdf", idTicket); if (File.Exists(NameConventions)) { File.Delete(NameConventions); } bool success = ITextWrapper.CreatePDF(TemplateConverter .FillTemplate(DAO.GetTickets() .Where(t => t.Id == idTicket) .Select(t => t.Template.Contenido).FirstOrDefault() ?? "", DAO.GetDictionaryFromIdTicket(idTicket)), NameConventions); if (success) { return(File.ReadAllBytes(NameConventions)); } return(new byte[0]); }