Skip to content

Instantly share code, notes, and snippets.

@uhop
Created April 24, 2023 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uhop/d54cbba0cad5ee27731ff4e3d500e09a to your computer and use it in GitHub Desktop.
Save uhop/d54cbba0cad5ee27731ff4e3d500e09a to your computer and use it in GitHub Desktop.
Multi-page print test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Multi-page print test</title>
<!--
Print to PDF, landscape, letter size, no margins, enable background graphics.
Tested on Chrome.
-->
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
.page {
page-break-inside: avoid;
break-inside: avoid;
page-break-before: always;
break-before: page;
background-image: radial-gradient(
circle at 50% 50%,
#00c 0%,
#002 100%
);
color: white;
padding: 1em;
height: 95%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.page:first-child {
page-break-before: avoid;
break-before: avoid;
}
</style>
</head>
<body>
<div class="page">
<h1>Slide 1</h1>
<p>Slide text.</p>
</div>
<div class="page">
<h1>Slide 2</h1>
<p>Slide text.</p>
</div>
<div class="page">
<h1>Slide 3</h1>
<p>Slide text.</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment