Print PDF filled in with .text

-1

I am creating an offer creator where there is a standard form and only replaces price and customer data. So my intention is to print that filled form with the variables captured in the Textbox.text

If someone could explain or give me an example of how to do it, I would appreciate it. Thanks

    
asked by S.Carrillo 14.08.2018 в 11:55
source

2 answers

0

To generate the PDF you can use a NuGet called iTextSharp, here is an example of its use:

var myDocument = new Document();
PdfWriter.GetInstance(myDocument, new FileStream(ruta, FileMode.Create));
myDocument.Open();
myDocument.Add(new Paragraph("My first PDF"));
myDocument.Close();
    
answered by 14.08.2018 в 12:56
0

There are several ways to do it,

Create a class that is called Data and in the public class Data you will add some variables in this way

 public string Orden {get; set;}
        public string Descripcion { get; set; }

These variables will receive the parameters

in your main form where you will have the txtbox you will send the content to the data variables as follows

ReportV c = new ReportV();

                Datos dat = new Datos();

                dat.Orden = (string)this.txtbox1.Value;
                dat.Descripcion = (string)this.txtbox2.Value;

                c.Datos.Add(dat);
            }

            c.Show();

In the end it is to add some cells in the report viewer and add the variable of the data and you can generate it and export it to PDF, EXCEl and others.

I hope it serves you, regards

    
answered by 14.08.2018 в 16:59