I have this code. Prints the contents of the DIV by its ID, but omits one picture. I hope you will support me and tell me how to include this image. (The picture is also inside the DIV)
impresion = DIV to print
function printDiv(impresion) { var contenido= document.getElementById(impresion).innerHTML; var contenidoOriginal= document.body.innerHTML; document.body.innerHTML = contenido; window.print(); document.body.innerHTML = contenidoOriginal; }
I tried many methods but none of them worked
P粉2708916882023-09-11 10:56:43
Here is a simple solution using only CSS:
@media print { body * { visibility: hidden; } #impresion, #impresion * { visibility: visible; } #impresion { position: absolute; left: 0; top: 0; } }