0
任何人都可以幫助我出口pdf表格pdf。我的文件不獲取導出爲PDF格式,它也沒有表現出我寫了下面的代碼的代碼用於導出爲PDF任何錯誤,但它不能正常工作,我有使用iTextSharp的DLL編寫代碼導出到pdf不能在asp.net工作
her is my code
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
Paragraph p, p1, p2;
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
string imagepath = GetImageUrl("images");
iTextSharp.text.Image gif = iTextSharp.text.Image.GetInstance(imagepath + "/Logo.png");
p2 = new Paragraph();
p2.Add(gif);
p2.Alignment = Element.ALIGN_LEFT;
pdfDoc.Add(p2);
p1 = new Paragraph(new Phrase(new Chunk(" INVOICE ", FontFactory.GetFont("verdana", 15, BaseColor.GRAY))));
p1.Alignment = Element.ALIGN_CENTER;
pdfDoc.Add(p1);
p = new Paragraph(new Chunk("\n"));
pdfDoc.Add(p);
pdfDoc.Add(table1);
pdfDoc.Add(table);
string str = "This is a computer generated invoice. Please contact MSWindowsCare billing for more information at [email protected]";
p = new Paragraph(str, FontFactory.GetFont("verdana", 7, BaseColor.GRAY));
p.Alignment = Element.ALIGN_CENTER;
pdfDoc.Add(p);
pdfDoc.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;" + "filename=SalesInvoice.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(pdfDoc);
HttpContext.Current.ApplicationInstance.CompleteRequest();