No images in this repository’s iceberg at this time
Download raw (4.6 KB)
/** * This file is based on the HTML2print boilerplate. * * */ /** * Computation */ /* computes the edge size of the paper, which is the sum of the bleed and the * crop sizes */ @edge: @crop-size + @bleed; /* Computes the size of the paper sheet */ @paper-width: @page-width + ( @edge * 2 ); @paper-height: @page-height + ( @edge * 2 ); /* computes the width of a spread, which is twice the width of a single page */ @spread: @page-width * 2; /** * DEFINITION OF THE PAPER SHEET */ /** * The @page CSS at-rule is used to define some properties of printed * documents. We make it the size of the elements with the .paper class and * remove any margins so they don't add up with margins specifed in elements * with the .page class (or it's children, like .header, .body and .footer) */ @page { size: @paper-width @paper-height; margin: 0; } /** * CANVAS */ @media all { body { margin: 0; } .paper { width: @paper-width; height: @paper-height; box-sizing: border-box; /* Crop marks */ padding: @edge; /* defines a named counter and increments it every page, so we can use * it to compute the page number */ counter-increment: page-counter; /* utile ou non? pour éviter qu'un papier soit coupé par le format de la * page lors de la conversion et l'arrondis des unités */ page-break-inside: avoid; page-break-after: always; overflow: hidden; /* Crop marks */ background-image: -webkit-linear-gradient(90deg, black 0, black 100%), -webkit-linear-gradient(0deg, black 0, black 100%), -webkit-linear-gradient(90deg, black 0, black 100%), -webkit-linear-gradient(0deg, black 0, black 100%), -webkit-linear-gradient(90deg, black 0, black 100%), -webkit-linear-gradient(0deg, black 0, black 100%), -webkit-linear-gradient(90deg, black 0, black 100%), -webkit-linear-gradient(0deg, black 0, black 100%) ; background-size: @crop-size 1px, 1px @crop-size, @crop-size 1px, 1px @crop-size, @crop-size 1px, 1px @crop-size, @crop-size 1px, 1px @crop-size ; background-position: left @edge, @edge top, right @edge, (@paper-width - @edge) top, right (@paper-height - @edge), (@paper-width - @edge) bottom, left (@paper-height - @edge), @edge bottom ; background-repeat: no-repeat; } .page { /* defines the page size */ width: @page-width; height: @page-height; /* allows for absolutely positioned elements as settings the position * property to relative as the side effect of making this elements * top-left corner the reference point */ position: relative; text-rendering: optimizeLegibility; } // TODO: changer le format du papier en spread pour pouvoir imprimer en planche .spread .paper { float: left; } .spread .paper:nth-child(odd) { margin-left: -@edge; } .spread .paper:nth-child(even) { margin-right: -@edge; } .spread .paper:first-child { margin-left: @page-width; } } @media screen { body { background-color: #F0F0F0; } #pages { width: @paper-width; height: @paper-height; margin-left: auto; margin-right: auto; } .spread #pages { width: @paper-width * 2; height: @paper-height * 2; } .paper { /* centrer la page à l'écran */ background-color: white; margin-top: 1em; margin-bottom: 1em; } .normal .page { outline: 1px dashed lightsalmon; } .preview .paper { background: none; } .preview .page { outline: 1px solid lightgray; background-color: white; } .debug #story { outline: 1pt solid green; } } @media print { html { width: @paper-width; } body { /* Allows for background colors printing */ background-color: white; -webkit-print-color-adjust: exact; print-color-adjust: exact; } } /** * Helpers */ .region-break { /* Apply this class to an element to put it on a new region. * Hint: * You can also use an empty <div class="page-break"></div> * if you want to put manual page breaks without attaching it to an HTML element */ -webkit-region-break-before: always; } .debug .region-break { border-top: 1pt dashed blue; }