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

css and layout fiels not accessible on Debian 10 #227

Open
PowerICT opened this issue Sep 22, 2021 · 0 comments
Open

css and layout fiels not accessible on Debian 10 #227

PowerICT opened this issue Sep 22, 2021 · 0 comments

Comments

@PowerICT
Copy link

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?

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