How can I change the entire page color of a PDF generated by NBConvert-ing a Jupyter Notebook Markdown .ipynb file?

49 views Asked by At

So I'm using a Windows 10 machine right now. I have a few .ipynb files that I want to convert. I can convert them perfectly fine with the following command.

jupyter nbconvert --to webpdf --allow-chromium-download randomfile1.ipynb

However, while this works perfectly, and I am able to get the desired display for the most part in the generated PDF, I have an issue where, even when setting a background color and page color, the borders of the page are still their default white. For reference, I have this, among others, in <style></style> tags in my files.

@page {
border-top: 1px solid red !important;
border-left: 1px solid red !important;
border-right: 1px dashed orange !important;
border-bottom: 1px dashed green !important;
background-color: #000B06 !important;
}
body, html {
color: #00ff31 !important;
background-color: #000B06 !important;
}

How do I go about either covering the entire page or changing the page color by default to be this specified color? I know that this should work because the font color and other stylistic choices of mine work perfectly, but some of this just isn't working for some reason or another. For example, background-color: #000B06 !important; works in the html section, but nothing in the @page section works as intended. Do I need to mess around with anything beyond this? I know that there are some .tpl and .tplx files that control this thing's behavior. Do I need to edit those? Some of the sources that I found online while trying to make this work suggested that, but I couldn't find a clear answer. Thank you. I'm just trying to make a nice presentable PDF file with a satisfactory page color on the entire thing. This is my biggest issue in terms of making it look good.

0

There are 0 answers