Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

wkhtmltopdf page break

By
Mohammed Khamis
on 11/16/14, 2:53 AM 2,132 views

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 11/16/14, 2:53 AM
Seen: 2132 times
Last updated: 3/16/15, 8:10 AM