private void button1_Click(object sender, EventArgs e) { Factura fx = new Factura(Convert.ToInt32(txtSecuencia.Text), txtCedula.Text); PanelReporte pos = new PanelReporte(); pos.PosicionPanel.X = float.Parse(textBox1.Text); pos.PosicionPanel.Y = float.Parse(textBox2.Text); fx.GenerarPDF("Prueba", pos);//, , float.Parse(textBox3.Text), float.Parse(textBox4.Text)); Configuraciones.Set("x", textBox1.Text); Configuraciones.Set("y", textBox2.Text); Configuraciones.Set("x2", textBox3.Text); Configuraciones.Set("y2", textBox4.Text); }
public void GenerarPDF(string filename, PanelReporte pos) { CerrarPDF(filename); //Genera PDF System.IO.FileStream fs = new FileStream(this.PathExportFile + "/" + filename + ".pdf", FileMode.Create); Document document = new Document(PageSize.A4, 25, 25, 30, 30); PdfWriter writer = PdfWriter.GetInstance(document, fs); document.AddTitle("Prueba de Documento de Factura"); document.Open(); DrawPanelFactura(document, writer, new FormatoFactura()); document.Close(); writer.Close(); fs.Close(); //System.Windows.Forms.MessageBox.Show("Se a generado el PDF correctamente"); AbrirPDF(filename); }