Skip to content

Instantly share code, notes, and snippets.

@egardner
Created February 18, 2016 22:24
Show Gist options
  • Save egardner/89c748c168eb6dd434e7 to your computer and use it in GitHub Desktop.
Save egardner/89c748c168eb6dd434e7 to your computer and use it in GitHub Desktop.
Starter print stylesheet (for Prince XML)
// Variables
// -----------------------------------------------------------------------------
$page-width: 8.5in;
$page-height: 11in;
$bleed: 0.125in;
$bleed-height: 11.25in;
$bleed-width: 8.75in;
$bottom-margin: 1in;
$top-margin: 0.875in;
$inner-margin: 1in;
$outer-margin: 0.75in;
$inner-width: $page-width - ($inner-margin + $outer-margin);
$inner-height: $page-height - ($top-margin + $bottom-margin);
$print-base-font-size: 9.5pt;
$print-base-spacing: 0.125in;
$print-base-line-height: 1.3;
$print-paragraph-indent: 0.25in;
$print-background-color: #fff;
$print-text-color: #000;
$page-number-size: 7.5pt;
$footnote-size: 7.5pt;
$medium-gray: transparentize($print-text-color, 0.5);
$light-gray: transparentize($print-text-color, 0.5);
// Default page setup
// -----------------------------------------------------------------------------
// scss-lint:disable PropertySpelling
// @prince-pdf { prince-pdf-page-layout: two-column-right; }
@page {
size: $page-width $page-height;
bleed: $bleed;
prince-trim: 0.25in;
marks: crop;
}
@page:left {
margin-bottom: $bottom-margin;
margin-left: $outer-margin;
margin-right: $inner-margin;
margin-top: $top-margin;
@bottom-left {
//content: counter(page) "\2003" string(doctitle);
content: counter(page);
font-family: $base-font-family;
font-size: $page-number-size;
}
}
@page:right {
margin-bottom: $bottom-margin;
margin-left: $inner-margin;
margin-right: $outer-margin;
margin-top: $top-margin;
@bottom-right {
content: counter(page);
font-family: $base-font-family;
font-size: $page-number-size;
}
}
@page bleed {
margin: 0;
@bottom-left { content: none; }
@bottom-right { content: none; }
}
@page frontmatter:left {
margin-bottom: $bottom-margin;
margin-left: $outer-margin;
margin-right: $inner-margin;
margin-top: $top-margin;
@bottom-left { content: counter(page, lower-roman); }
}
@page frontmatter:right {
margin-bottom: $bottom-margin;
margin-left: $inner-margin;
margin-right: $outer-margin;
margin-top: $top-margin;
@bottom-right { content: counter(page, lower-roman); }
}
@page no-footer:left {
margin-bottom: $bottom-margin;
margin-left: $outer-margin;
margin-right: $inner-margin;
margin-top: $top-margin;
@bottom-left { content: none; }
@bottom-right { content: none; }
}
@page no-footer:right {
margin-bottom: $bottom-margin;
margin-left: $inner-margin;
margin-right: $outer-margin;
margin-top: $top-margin;
@bottom-left { content: none; }
@bottom-right { content: none; }
}
// scss-lint:enable PropertySpelling
@egardner
Copy link
Author

This is basic page layout boilerplate for things like page numbers (including roman numerals for fronmatter), margins, etc. Designed for use with PrinceXML but most of this will work anywhere. Prince extensions are the things that look like errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment