0
I am creating a c# method in which the user enters a data listing and assembles a pdf document for each data entered.
I’m using the iTextSharp library. On the first data it generates the PDF as expected, but when checking the code it stops on Response.End()
and prevents you from reading the other data to generate the next Pdfs.
The doubt would be, how could I do to generate Pdfs uninterruptedly until all user inputs have 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
}
What loop are you talking about??
– Leandro Angelo
Sorry, I think it was not very clear my question, so the user enters with a block of plates through a txt file, I take each registration and consult some tables in the bank, from there mount the pdf document. However, it always stops in "Response.End();" and does not come back to consult the later lines with the enrollments, it already downloads the document directly.
– Rafael Veloso
Where is the
Loop
?– João Martins