简体   繁体   中英

Add Page number using Page Property of CSS for each printed pages from asp.net c#

I am trying to print 33 pages from my website but I need to add page number to each printed page using css I saw alot of solution for that like How to print page number using css , get printed page number of an element and Page numbers with CSS/HTML but nothing working for me and it's return an error in @bottom-right that ' is not a known CSS property name '

my CSS :

  <style type="text/css" >
    @media print
    {
      table.break {page-break-after: left}
    .no-print, .no-print *
   {
      display: none; 
     }
     }

  @page {
      @bottom-right {
     content: counter(page) " of " counter(pages);
    }
   }
   </style>

To me, the errors you are getting appear to be validation errors. There are components absent in the CSS 2.1 spec although being supported by all major browsers.

You could try changing your stylesheet validation to CSS3.

If you are using VS, then

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\1033\schemas\CSS\css30.xml

is where you could begin.

You need to increment page somehow, look at the examples you have posted already:

counter-increment: page;
    counter-reset: page 1;

Use pure examples, try if they work, and then try to adapt to your needs.

Further reading

Where are you getting that error?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM