Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net iTextSharp未在PDF中生成表边框_Asp.net_Vb.net_Pdf Generation_Itextsharp - Fatal编程技术网

Asp.net iTextSharp未在PDF中生成表边框

Asp.net iTextSharp未在PDF中生成表边框,asp.net,vb.net,pdf-generation,itextsharp,Asp.net,Vb.net,Pdf Generation,Itextsharp,我正在使用iTextSharp生成PDF文件,但边框未显示在我的PDF文件中。如何使用PDF生成边框 生成pdf的代码: Private Sub GeneratePDFReport(repeaterName As Repeater) Response.ContentType = "application/pdf" Response.AddHeader("content-disposition", "attachment;filename=Vasundhara.pd

我正在使用iTextSharp生成PDF文件,但边框未显示在我的PDF文件中。如何使用PDF生成边框

生成pdf的代码:

Private Sub GeneratePDFReport(repeaterName As Repeater)
        Response.ContentType = "application/pdf"
        Response.AddHeader("content-disposition", "attachment;filename=Vasundhara.pdf")
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Dim sw As New StringWriter()
        Dim hw As New HtmlTextWriter(sw)
        repeaterName.RenderControl(hw)
        Dim sr As New StringReader(sw.ToString())
        Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F)
        Dim htmlparser As New HTMLWorker(pdfDoc)
        PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
        pdfDoc.Open()
        htmlparser.Parse(sr)
        pdfDoc.Close()
        Response.Write(pdfDoc)
        Response.[End]()
    End Sub
任何人都可以帮助我。如何在PDF文件中显示边框
我的PDF截图附在本文后

将此代码添加到按钮单击中

    var styles = new StyleSheet();
    styles.LoadTagStyle("body", "border", "1");
    htmlparser.SetStyleSheet(styles);

HTMLWorker
已过时。请改为尝试
XMLWorker
。您好,mkl,XMLWorker未显示在我的iTextSharp中。它是单独分发的,请参见。如果您的
HTML
包含不推荐的
border
属性,它将与
HTMLWorker
一起使用。例如,
。很奇怪为什么
HTMLWorker
这么多年都没有从源代码中删除…你好kuujinbo,你能给我任何演示链接或代码吗。。。。。实际上我是初学者,我不太懂