我在iTextSharp中创建了一个表,所有商品,但我想保存在specfific文件夹中;
我的代码是:
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=" & so & ".pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim pdfDoc As New Document(PageSize.A4, 0.0F, 0.0F, 10.0F, 0.0F)
Dim htmlparser As New HTMLWorker(pdfDoc)PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
pdfDoc.Open()
HERE CODE !!! 在这里,我放置了我的代码并创建了PDF,我完成了:
pdfDoc.Close()
Response.Write(pdfDoc)
Response.[End]()
我把我的位置放在哪里:
“\本领域FS02 \ 07_ART_ECO \ 12_Samples \ 03_Samples_order \ 01_Samples_BOMs_&安培; _DRW \”
答案 0 :(得分:1)
只需使用FileStream保存文档。
Dim pdfDoc As New Document(iTextSharp.text.PageSize.A4)
Dim pdfWrite As PdfWriter = PdfWriter.GetInstance(pdfDoc, New FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + "yourPDFdesiredName.pdf", FileMode.Create))