I am working on an Aurelia app that requires printing out labels. The challenge I am facing is getting a hidden div on the page, containing the label layout, to be printed in full size and stretched to fit the entire page in landscape orientation. Currently, the div only occupies a small corner of the page.
For those interested, you can view the JSFiddle here.
I have attempted to use CSS to achieve this, but changes to the @page properties seem to have no effect. I have tried adjusting page sizes as well, but the div remains stuck in one corner.
@media print {
header, footer, .print-hidden {
visibility: hidden;
}
@page {
size: auto;
margin: 0mm;
}
html, body {
height: 100%;
width: 100%;
}
.print-show{
display: block;
position: absolute;
width: 100vw;
height: 100vh;
top: 0;
bottom: 0;
}
}
This is the Aurelia template structure for the label:
<template bindable="firstname, lastname, company, inviter, uniquecode">
<div class="label-container">
<div class="row justify-content-start mx-0 px-1 pt-1">
[...] <!-- Template continues with label details -->
Below are the custom CSS classes used for styling the label components:
.label-container{
width: 350px;
height: 188px;
}
[...] <!-- Custom CSS styles for different label elements -->