private void toPDF() { string aux = Application.StartupPath; aux += "\\Logo.jpeg"; iTextSharp.text.Image imagen= iTextSharp.text.Image.GetInstance(aux); Document doc = new Document(PageSize.A4.Rotate(), 10, 10, 10, 10); SaveFileDialog savefiledialog1 = new SaveFileDialog(); savefiledialog1.InitialDirectory = @"C:"; savefiledialog1.Title = "Guarda reporte"; savefiledialog1.DefaultExt = "pdf"; savefiledialog1.Filter = "pdf Files (*.pdf)|*.pdf| All Files (*.*)|*.*"; savefiledialog1.FilterIndex = 2; savefiledialog1.RestoreDirectory = true; string filename = ""; if (savefiledialog1.ShowDialog() == DialogResult.OK) { filename = savefiledialog1.FileName; } if (filename.Trim() != "") { FileStream file = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); PdfWriter pdfw=PdfWriter.GetInstance(doc, file); doc.Open(); doc.Add(imagen); doc.Add(new Paragraph(" COMPLEJO EDUCATIVO COLONIA TIERRA VIRGEN ")); doc.Add(new Paragraph(" PROMEDIOS TRIMESTRALES")); doc.Add(new Paragraph(" GRADO:" + cbGrado.Text + " SECCIÓN:" + cbSeccion.Text + " ASIGNTURA:" + cbMateria.Text)); doc.Add(new Paragraph(" ")); doc.Add(new Paragraph(" DOCENTE:"+pr.Nombrereportfinal(Usuario.usuario)+" FIRMA:________________________")); doc.Add(new Paragraph(" ")); doc.Add(new Paragraph(" PRIMER TRIMESTRE |SEGUNDO TRIMESTRE |TERCER TRIMESTRE |")); doc.Add(new Paragraph(" ")); GenerarDocumento(doc); pdfw.PageEvent = new PDFFooter(); doc.Close(); Process.Start(filename); } }