将HTML转换为PDF时,页脚无法呈现

时间:2014-09-04 06:45:38

标签: c# .net pdf-generation pechkin tuespechkin

我使用TuesPechkin将HTML转换为PDF,并且我指定了HTML文件的网址,该文件应该在每个页面上显示为页脚,但它不会呈现页脚。作为测试,我甚至尝试将LeftText设置为某些东西并且不会渲染。

我的代码如下:

Dim FooterURL As String = "http://localhost:60699/testfooter.html"



                Dim globalSettings As New TuesPechkin.GlobalSettings With {.PaperSize = PaperKind.A4,
                                                                            .DocumentTitle = DocTitle,
                                                                           .Margins = New TuesPechkin.MarginSettings With {.Unit = TuesPechkin.Unit.Millimeters, .Bottom = 20, .Left = 20, .Right = 20, .Top = 20},
                                                                           .Copies = 1,
                                                                           .ImageQuality = 100,
                                                                           .ImageDPI = 300,
                                                                           .ProduceOutline = True,
                                                                           .PageOffset = 0,
                                                                           .DPI = 1200,
                                                                           .Orientation = TuesPechkin.GlobalSettings.PaperOrientation.Portrait}

                Dim pdfdoc As New TuesPechkin.HtmlToPdfDocument
                pdfdoc.Objects.Add(New TuesPechkin.ObjectSettings With {.HtmlText = strHTML,
                                                                        .FooterSettings = New TuesPechkin.FooterSettings With {.HtmlUrl = FooterURL, .LeftText = "blah blah blah"},
                                                                        .WebSettings = New TuesPechkin.WebSettings With {.LoadImages = True,
                                                                        .PrintBackground = True,
                                                                        .EnableJavascript = False}
                                                                       })
                Dim convertor As TuesPechkin.IPechkin = TuesPechkin.Factory.Create
                Dim buf As Byte() = convertor.Convert(strHTML)
                Return buf

1 个答案:

答案 0 :(得分:2)

此问题已在版本1.1.0中修复,尚未发布。

请参阅https://github.com/tuespetre/TuesPechkin/issues/46

您可以从GitHub中提取源代码并自行构建当前代码以解决问题。

编辑:从版本2.0.0开始,现在应该修复。

https://github.com/tuespetre/TuesPechkin/releases