saison-graphique
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

html2print.less
text/plain

Download raw (5.3 KB)

/**
 * Computation
 */


/* EXTRA SPACE AROUND THE PAGE: BLEED + CROP */
// TODO: find a more appropriate name
@crop: @crop-size + @bleed; 

/* GEOMETRY OF THE PAPER SHEET */
@paper-width: @page-width + ( @crop * 2 );
@paper-height: @page-height + ( @crop * 2 );

/* SIZE OF SPREAD */
@spread: @page-width * 2;



/**
 * DEFINITION OF THE PAPER SHEET
 */
@page {
    size: @paper-width (@paper-height + 5); 
    margin: 0;
}


/**
 * CANVAS
 */

@media all {
    body {
        margin: 0;
    }
    .h2p-paper {
        width: @paper-width; 
        height: @paper-height;
        box-sizing: border-box;

        /* Crop marks */
        padding: @crop;

        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 */
        padding: @crop;
        position: relative;
        .crops {
            width: @paper-width; 
            height: @paper-height;
            position: absolute;
            top: 0;
            left: 0;

            div {
                border-style: solid;
                border-color: black;
                border-width: 0;
                width: @crop;
                height: @crop;
                position: absolute;
                box-sizing: border-box;

                span {
                    width: @crop-size;
                    height: @crop-size;
                    position: absolute;
                    border-style: solid;
                    border-color: black;
                }
                span.bleed--horizontal {
                    width: @crop-size;
                    height: @crop;
                }
                span.bleed-vertical {
                    width: @crop;
                    height: @crop-size;
                }
            }
            .crop-top-left {
                //border-right-width: 1px;
                //border-bottom-width: 1px;
                top: 0;
                left: 0;

                span.bleed--horizontal { 
                    left: 0px; 
                    top: 0px;
                    border-bottom-width: 1px;
                }
                span.bleed--vertical { 
                    right: 0; 
                    top: 0;
                    border-right-width: 1px;
                }
            }
            .crop-top-right {
                //border-left-width: 1px;
                //border-bottom-width: 1px;
                top: 0;
                right: 0;

                span.bleed--horizontal { 
                    right: 0px; 
                    top: 0px;
                    border-bottom-width: 1px;
                }
                span.bleed--vertical { 
                    left: 0; 
                    top: 0;
                    border-left-width: 1px;
                }
            }
            .crop-bottom-right {
                //border-left-width: 1px;
                //border-top-width: 1px;
                right: 0;
                bottom: 0;

                span.bleed--horizontal { 
                    right: 0px; 
                    bottom: 0px;
                    border-top-width: 1px;
                }
                span.bleed--vertical { 
                    left: 0; 
                    bottom: 0;
                    border-left-width: 1px;
                }
            }
            .crop-bottom-left {
                //border-right-width: 1px;
                //border-top-width: 1px;
                left: 0;
                bottom: 0;

                span.bleed--horizontal { 
                    left: 0px; 
                    bottom: 0px;
                    border-top-width: 1px;
                }
                span.bleed--vertical { 
                    right: 0; 
                    bottom: 0;
                    border-right-width: 1px;
                }
            }
        }

    }
    .h2p-page {
        width: @page-width;
        height: @page-height;
        box-sizing: border-box;
        position: absolute; // in webkit, the page is really small in height otherwise
        text-rendering: optimizeLegibility;
    }

}

@media screen {
    body {
        background-color: #F0F0F0 !important;
    }

    #h2p-pages {
        width: @paper-width; 
        height: @paper-height;

        margin-left: auto;
        margin-right: auto;
    }
    .h2p-spread #h2p-pages {
        width: @paper-width * 2; 
        height: @paper-height * 2;
    }
    .h2p-paper {
        /* centrer la page à l'écran */
        background-color: white;
        margin-top: 1em;
        margin-bottom: 1em;
    }
}


@media print {
    html {
        width: @paper-width;
    }
    body {
        /* Allows printing of background colors */
        background-color: white;
        -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
    }
    #h2p-pages {
        // Forces this div to start at the top of the page (bug in Chromium)
        position: absolute;
        top: 0;
    }
}

/**
 * Helpers
 */

.h2p-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;
}