How to print with page numbers from the "print button"?

How to print with page numbers from the "print button"?

mlongmlong Posts: 10Questions: 5Answers: 0
edited November 2017 in DataTables 1.10

The things I normally would do in css and html do not seem to be working when I use the Datatables "print" button...

print button is set up like this:

 buttons: [
    {extend: 'print',
        text: 'Print Visible',
        autoPrint: true,
        exportOptions: { columns: ':visible' },
        customize: function (win) { 
              $(win.document.body).find('table').addClass('display').css('font-size', '10px');
       }
},

And the css for the page looks like this:

@page {
    margin: .25in;
    
    @bottom-right {
        content: counter(page) " / " counter(pages);
    }
}

But I see no page numbers. How can I get page numbers on the bottom right of my printed pages?

Any help is appreciated.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you link to the page showing the issue please? As far as I am aware, that should be all that is needed.

    Allan

  • mlongmlong Posts: 10Questions: 5Answers: 0

    Thank you for responding allan. I would link to the page if I could. It does help to know I'm not missing anything obvious. Now I'm suspecting some type of conflict or something.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    The way I normally debug stuff like that is to add autoPrint: false into the configuration for the print button and that will leave the print view window open. You can then inspect it as you would any other page and check to see if the style is present or not.

    Allan

This discussion has been closed.