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

bug: not all css applied (background-color) #49

Closed
Prowluan opened this issue Nov 8, 2019 · 3 comments
Closed

bug: not all css applied (background-color) #49

Prowluan opened this issue Nov 8, 2019 · 3 comments
Labels

Comments

@Prowluan
Copy link

Prowluan commented Nov 8, 2019

I'm trying to generate a pdf using the config file, with a css file, but not all CSS is applied. It does not generate an error on the config.

  • version (md-to-pdf -v): 2.7.1
  • platform (Unix, macOS, Windows): windows
  • node version: v8.12.0

When I generate a pdf using config, which contains header and footer content and a css file, the generated pdf does not have all css applied. Below I have applied 2 screenshots; one containing how it should look (this does not use a config file, using a css file), and one how it looks with the config file, using a css file.

My config file looks like this:

{
"pdf_options": {
"format": "A4",
"margin": "20mm",
"displayHeaderFooter": false
},
"stylesheet": "style.css"
}

Any idea why the css is not applied as I want it to?

case1
case2

@Prowluan Prowluan added the bug label Nov 8, 2019
@simonhaenisch
Copy link
Owner

Hey, sorry for the late reply. I assume that the problem is that you don't have "printBackground": true set in your pdf options... could you try that and let me know if it worked? Thanks!

@simonhaenisch simonhaenisch changed the title bug: bug: not all css applied (background-color) Nov 16, 2019
simonhaenisch added a commit that referenced this issue Nov 16, 2019
It's too common that people forget this option (see #49 or #50).
@Prowluan
Copy link
Author

Works like a charm, thanks!

@simonhaenisch
Copy link
Owner

I actually detected a bug regarding this... if you use the frontmatter for the config, then printBackground will be set to true by default, even if you provide your own pdf_options. However the behavior isn't the same if you use the config file instead. This has been fixed in v3 which I hope to release soon.

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

No branches or pull requests

2 participants