2016-06-08 338 views
0

我在iTextSharp中创建一个表,所有商品,但我想保存在特定的文件夹;如何将PDF文件保存到文件夹? vb.net或itsharptext

我的代码是:

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() 

这里CODE! 在这里,我把我的代码,创建PDF,我完成与:

pdfDoc.Close() 

    Response.Write(pdfDoc) 
    Response.[End]() 

这里我把我的位置这样的:

“\艺术FS02 \ 07_ART_ECO \ 12_Samples \ 03_Samples_order \ 01_Samples_BOMs_ & _DRW \“

回答

0

只需使用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)) 

Saving PDF files to desktop [VB .NET]

+0

不工作:( – Vladut