Customize printing properties in asp.net
I need to print some pictures in asp.net page and I need to print every picture in a separate 开发者_JS百科page. How can I do this using ASP.net C#?
When I use window.print() it prints the whole page, but I need just the images and also every image in a separate page!
You need to define some things in your stylesheet (.css) file:
@media all
{
.page-break { display:none; }
}
@media print
{
.page-break { display:block; page-break-before:always; }
}
Then, in your HTML, whenever you'd like a page break:
<div class="page-break"></div>
You can hide/show elements in your print layout the same way (by using @media print
and setting display:none
on any element you don't want to print. For example, to only display images in a print layout, this might work (untested):
@media print
{
* { display:none; }
img { display:block; }
.page-break { display:block; page-break-before:always; }
}
精彩评论