@media print {
html, body {
margin: 0 !important;
padding: 0 !important;
background: #fff !important;
}
body * {
visibility: hidden !important;
}
.response, .response * {
visibility: visible !important;
height: auto !important;
overflow: visible !important;
}
.response {
position: absolute !important;
left: 0 !important;
top: 0 !important;
width: 100% !important;
box-sizing: border-box !important;
padding: 0 !important; /* adjust if you want margins */
}
/* hide persistent admin elements explicitly to be safe */
#wpcontent, #wpfooter {
margin: 0 !important;
}
#wpadminbar, #adminmenu, #adminmenumain, #wpfooter, #screen-meta, #screen-meta-links, .wrap .page-title-action {
display: none !important;
visibility: hidden !important;
}
/* optional: adjust font-size and page breaks for printing */
body, .response {
font-size: 12pt !important;
}
.response img {
max-width: 100% !important;
height: auto !important;
}
/* avoid cutting sections awkwardly */
.no-break {
page-break-inside: avoid !important;
}
}