Skip to content

Commit

Permalink
Support fractional height (#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay authored Sep 22, 2020
1 parent 8ee6dbd commit d880216
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
11 changes: 3 additions & 8 deletions nbconvert/exporters/webpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ async def main():

dimensions = await page.evaluate(
"""() => {
const rect = document.body.getBoundingClientRect();
return {
width: document.body.scrollWidth,
height: document.body.scrollHeight,
width: rect.width,
height: rect.height,
}
}"""
)
Expand All @@ -57,12 +58,6 @@ async def main():
# 200 inches is the maximum height for Adobe Acrobat Reader.
'height': min(height, 200 * 72),
'printBackground': True,
'margin': {
'left': '0px',
'right': '0px',
'top': '0px',
'bottom': '0px',
},
}
)
await browser.close()
Expand Down
3 changes: 3 additions & 0 deletions share/jupyter/nbconvert/templates/classic/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ div#notebook-container{
{%- endif -%}
@media print {
body {
margin: 0;
}
div.cell {
display: block;
page-break-inside: avoid;
Expand Down
6 changes: 6 additions & 0 deletions share/jupyter/nbconvert/templates/lab/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ a.anchor-link {
.highlight {
margin: 0.4em;
}
@media print {
body {
margin: 0;
}
}
</style>

{% endblock notebook_css %}

{{ mathjax() }}
Expand Down
5 changes: 5 additions & 0 deletions share/jupyter/nbconvert/templates/reveal/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ a.anchor-link {
--jp-code-font-size: 19px; /* instead of 13px */
--jp-cell-prompt-width: 110px; /* instead of 64px */
}
@media print {
body {
margin: 0;
}
}
</style>

{{ resources.include_css("static/custom_reveal.css") }}
Expand Down

0 comments on commit d880216

Please sign in to comment.