Skip to Content
Menú
This question has been flagged
9220 Vistes

Hy Every body

I am try to use page break before when I want to convert html to pdf report by webkit but it doesn't work .

So I need To any one can help me to solve this issue

This is my script but the bage break is not work

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('table.basic_table').each(function(i, tabela){
            var per_page = 5;
            
            var pages = Math.ceil($('tbody tr').length / per_page);

            if (pages == 1)
                return;

            var ultimo = $(tabela);
            for(var p = 1; p <= pages; p++) {
                var copy = ultimo.clone();

                $('tbody tr', ultimo).each(function(i, tr){
                    if (i >= per_page) {
                        $(tr).remove();
                    }
                });

                $('tbody tr', copy).each(function(i, tr){
                    if (i < per_page) {
                        $(tr).remove();
                    }
                });

                if (p < pages)
                    copy.insertAfter(ultimo);

                copy.css('page-break-before', 'always');

                ultimo = copy;
            }
        });
    });
</script>

Thanks Alot

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de març 25
1979
1
de març 25
2094
2
de jul. 24
4586
1
de maig 24
3047
2
de febr. 24
3781