How to integrate PrintCSS into WeWeb to hide certain elements for printing or PDF export using CSS when @media print
is specified. While I could potentially manage the hiding part with a workflow, I’d like to print a specific section with predefined settings for orientation (either portrait or landscape). This means I don’t want users to have the option to change orientation in the print dialog, as I want the PDF to have perfect page breaks and layout without allowing customization that might lead to unwanted adjustments.
Is this possible? @Broberto has referenced PrintCSS in many topics related to PDF creation, so I’d like to understand how this can be incorporated into WeWeb.
That’s the css code i would like to use:
@media print {
/* Hide navigation and footer */
.navbar, .footer {
display: none;
}
/* Set page size and orientation */
@page {
size: A4 landscape;
margin: 1cm;
}
/* Additional print-specific styles */
.print-section {
font-size: 12pt;
color: #000;
}
}
<link rel="stylesheet" href="URL-of-my-uploaded-css-file">
In yesterday’s Office Hours, I briefly mentioned my question about whether @media print
or @page
is already functional in WeWeb. @flo mentioned that this is currently not possible, though there’s another topic linked here. How to use @page css on a weweb page Was there any discussion about the integration of @page
and its rules? I wonder if it might be possible.