Set print properties in asp.net

I need to print multiple images on an asp.net page, and I need to print each image on a separate page. How to do it using ASP.net C #?

When I use window.print (), it prints the entire page, but I only need the images, as well as each image on a separate page!

+3
source share
1 answer

You need to define some things in the 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 need a page break:

<div class="page-break"></div>

/ ( @media print display:none , . , , ():

@media print
{
   * { display:none; }
   img { display:block; } 
   .page-break { display:block; page-break-before:always; }
}
+1

All Articles