I am creating a method in C # in which the user enters a listing of data and application mounts a pdf document for each given information.
I'm using the iTextSharp library. In the first one it generates the PDF as expected, however when checking in the code it stops at Response.End()
and prevents it from reading the other data to generate the next PDFs.
The question would be, how could you do to generate the PDFs uninterruptedly until all user input has been met?
Code:
protected void btn_pdf_Click(object sender, EventArgs e){
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 40f, 0f);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
HTMLWorker obj = new HTMLWorker(pdfDoc);
MemoryStream ms = new MemoryStream();
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, ms);
pdfDoc.Open();
pdfDoc.Add(table);
pdfDoc.Close();
Response.Clear();
Response.OutputStream.Flush();
Response.OutputStream.Close();
Response.End(); // Nesse ponto ele para o loop
}