gmanny / Pechkin

.NET Wrapper for WkHtmlToPdf static DLL. Allows you to utilize full power of the library.
400 stars 128 forks source link

Setting header does not seem to work #29

Open reikjarloekl opened 11 years ago

reikjarloekl commented 11 years ago

I have extended the TestApp included in the NuGet Package with the following lines, but no header is produced. Even setting the top margin to extreme values does not fix this. Any ideas what I am missing? Any help would be highly appreciated. Thanks in advance.

            ObjectConfig oc = new ObjectConfig();
            oc.SetIncludeInOutline(true);
            oc.SetAllowLocalContent(true);
            oc.Header.SetFontName("times");
            oc.Header.SetFontSize(13.0);
            oc.Header.SetCenterText("Test, 1, 2");
            oc.Header.SetLineSeparator(true);

            byte[] buf = sc.Convert(oc, htmlText.Text);
mattki commented 11 years ago

Headers and footers using any of the approaches below work for me (although I haven't tried the nuget test app). objConf.Footer.SetHtmlContent(url) objConf.Footer.SetLeftText("[page]"); objConf.Footer.SetTexts("[page]","[date]","[time]")

Perhaps you can try an HTML-based header (first method above). You can use an html template from here: https://code.google.com/p/wkhtmltopdf/issues/detail?id=306