我有一个aspx页面,我有两个按钮(MakePdf和View)在视图按钮上,gridview显示在页面上,makePDF我们可以下载PDF。 但我需要的是视图按钮代码应该在下载PDF后执行。 请给我一个解决方案。
Document document = new Document(PageSize.A4, 0, 0, 15, 12);
PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);
document.Open();
PdfPCell cell;
Phrase phrase;
PdfPTable table;
table = new PdfPTable(1);
table.SetWidths(new int[] { 10 });
table.SpacingBefore = 5f;
phrase = new Phrase();
phrase.Add(new Chunk("HSE Monthly Report ", TOPTextFont));
cell = new PdfPCell(new Phrase(phrase));
cell.HorizontalAlignment = Element.ALIGN_CENTER;
cell.Border = 0;
table.AddCell(cell);
table.CompleteRow();
document.Add(table);
document.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename= SampleExport.pdf");
Response.End();