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

Footer not working when there is an image #182

Open
thanuja89 opened this issue Nov 28, 2023 · 0 comments
Open

Footer not working when there is an image #182

thanuja89 opened this issue Nov 28, 2023 · 0 comments

Comments

@thanuja89
Copy link

thanuja89 commented Nov 28, 2023

I'm using DinkToPdf library in a .NET 7 web application to create a pdf. However, when I include a pdf in the footer, it does not work.

This is the code for generating the pdf.

var html = await _templateEngine.RenderAsync("Views/CalibrationCertificate.cshtml", calibrationCertificate);

var basePath = AppContext.BaseDirectory;
var footerViewPath = Path.Combine(basePath, "Resources", "Footer.html");

var doc = new HtmlToPdfDocument()
{
    GlobalSettings = {
        PaperSize = PaperKind.A4,
        Orientation = Orientation.Portrait
    },
    Objects = {
        new ObjectSettings()
        {
            HtmlContent = html,
            FooterSettings = new()
            {
                HtmUrl = footerViewPath,
            }
        }
    }
};

var result = _htmlToPdfConverter.Convert(doc);

This is the contents of Footer.html.

<div class="hr mt-2 mb-5 page-break-avoid" />

<div class="row mt-2 page-break-avoid">
    <div class="col-4">
    </div>
    <div class="col-4 d-flex justify-content-center">

    </div>
    <div class="col-4">
        <img src='logo.jpg' />
    </div>
</div>

This is my folder structure.
image

Generated pdf is empty when downloaded through the client app.

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

1 participant