Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HtmlToPdfDocument not working with body, header and footer set together. #171

Open
SIM128 opened this issue Jul 9, 2018 · 1 comment
Open

Comments

@SIM128
Copy link

SIM128 commented Jul 9, 2018

Hi,

I'v a problem converting a document with the PageUrl, Header and Footer set.

This is my method:

static void Main(string[] args) 
{
    PdfToolset pdfToolset = new PdfToolset(new Win64EmbeddedDeployment(new TempFolderDeployment()));
    IConverter converter = new StandardConverter(pdfToolset);

    HtmlToPdfDocument document = new HtmlToPdfDocument
    {
        GlobalSettings = {
            ProduceOutline = true,
            DocumentTitle = "DocumentTitle",
            PaperSize = new PechkinPaperSize("297mm", "420mm"),
        },
        Objects = {
            new ObjectSettings
            {
                PageUrl = $"http://localhost:5000/Document_1_1_1",
                FooterSettings = new FooterSettings {
                    HtmlUrl = $"http://localhost:5000/DefaultFooter",
                },
                HeaderSettings = new HeaderSettings {
                    HtmlUrl = $"http://localhost:5000/DefaultHeader",
                },
            }
        }
    };
}

The result is a pdf only with header and footer and nothing in the "body".

If i set HtmlText instead of PageUrl it works.

I tested the same via cli and it works:

PS> C:\Program Files\wkhtmltopdf\bin> .\wkhtmltopdf.exe -s A3 http://localhost:5000/Document_1_1_1 --footer-html http://localhost:5000/DefaultFooter --header-html http://localhost:5000/DefaultHeader --header-spacing 10 --footer-spacing 10 C:\Users\SIM\Downloads\test.pdf

I'm doing something wrong here?

@jackiemanzzz
Copy link

jackiemanzzz commented Apr 24, 2019

I have the same problem. If i add page url with another url, iss throw an exception which is wkhtmltox.dll_unloaded.

my code

var document = new HtmlToPdfDocument
        {
            GlobalSettings = {
                ProduceOutline = true,
                DocumentTitle = title,
                Orientation = orientation,
                PaperSize = PaperKind.A4,
                Margins =
                {
                    Left = 1.375,
                    Right = 1.375,
                    Top = top,
                    Bottom = bottom,
                    Unit = TuesPechkin.Unit.Centimeters
                }
            },
            Objects = {
                new ObjectSettings {
                    PageUrl = link,
                    HeaderSettings = new HeaderSettings{HtmlUrl = headerPath, ContentSpacing = 2 },
                    FooterSettings = new FooterSettings{HtmlUrl = footerPath,}
                }
            }
        } ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants