3
Good afternoon guys, I have a report that is generated on a page aspx
with bootstrap
and CSS
. The content of the report is within a div <div id="pdf2htmldiv">...</div>
where I call javascript for printing. But the page is presented for printing without the style
page. Have some way to print this report as it is presented with the style CSS
?
Javascript code:
<script>
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
</script>
Button call:
<input type="button" onclick="printDiv('pdf2htmldiv')" value="Imprimir" />
Content of the page:
<div id="pdf2htmldiv">
\\conteúdo do relatório
</div>
The Stylo of the table zebrada
not even the report borders. I can print according to the first image?
You want to do this without going into browser options to print background graphics?
– Sam
Look, it may be a case of print options as the @dvd comment indicates, or it may be that the css you are using cannot be printed. Post css code and it will be easier
– DiegoSantos
@dvd even with the options
imprimir gráficos de segundo plano
Zebra table Stylo does not appear.– Evandro
@Diegosanths css is the bootstrap standard for tables
class="table table-striped"
– Evandro
So this is probably the case that @dvd commented on. Have you tried this?
– DiegoSantos
@Diegosantos Yes, I’ve scored
imprimir gráficos de segundo plano
in print options.– Evandro
Dude, so in this case I believe that within @media print, you should put the colors like bootstrap does. You can’t reuse, because they must be using something that is not compatible. You think you can?
– DiegoSantos
@Diegosantos I will do new tests with @media print and set the table css
class="table table-striped"
– Evandro
I think maybe I don’t roll like this. Maybe I have to do it by hand using :Nth-Child(2n+1) or something like that. Good Tips?
– DiegoSantos
@Diegosantos No manjo! You could post some practical example?
– Evandro
I put an example. Qqr thing speaks
– DiegoSantos