Skip to content

css and layout fiels not accessible on Debian 10 #227

@AgostinoArcasensa

Description

@AgostinoArcasensa

Hi,
I'm trying to implement Rotativa.AspNetCore on my net5 Razor Pages project.
When i execute my code in local everything works smoothlly, but when i deploy my project on a Debian 10 machine (using a linux executable version of wkhtmltopdf.exe) my pdf files are printed without css and .html layouts (footer and header).

Both my css and layout files are in www, and i've assigned chmod 755 to each needed file

An example of my code:
CONTROLLER FUNCTION
return new ViewAsPdf("~/path/to/view.cshtml", data)
{
FileName = $"FileName.pdf",
ContentDisposition = Rotativa.AspNetCore.Options.ContentDisposition.Inline,
PageMargins = new()
{
Top = 30,
Left = null,
Right = null,
Bottom = 20
},
CustomSwitches = $"--header-html https://{HttpContext.Request.Host}/layouts/header.html --header-line --load-
error-handling ignore " +
$"--footer-html https://{HttpContext.Request.Host}/layouts/footer.html --footer-font-size 10 --
footer-line --footer-center "[page] / [topage]" --load-error-handling ignore"
};

VIEW CSS

I've hardcoded the HttpContext Scheme (https) because I'm using Apache to handle the Https redirect, and using HttpContext.Request.Scheme returns HTTP instead HTTPS in deploy.

I've tried to use the relative path instead of the url ("~/css/site.css") but it ends in a failure both in local and in deploy.

Can you help me to find a solution for my problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions