Add footer with xhtml2pdf in specific pages with Django

0

I have a default footer that is displayed on some pages when generating the PDF with xhtml2pdf using Django which should be positioned at the bottom of the page. But in some I do not want to display. With the current code I can position it at the bottom of the page. But when it is applied to all of them. How do I position the footer at the bottom of the page and not apply at all at the time of generating the PDF?

style of xhtm2pdf:

 @page {
    size: a4 portrait;
    @frame content_frame {
        left: 25pt; width: 550pt; top: 10pt; height: 850pt;
    }
    @frame footer_frame {
        -pdf-frame-content: footer_content;
        left: 50pt; width: 512pt; top: 750pt; height: 200pt;
    }
}

Footer:

<div id="footer_content">
<hr>
<p align="center">
    www.site.com.br <br/>

</p>

    
asked by anonymous 18.01.2018 / 23:04

1 answer

0

If you understand, what you want to do is to insert a specific footer in the pages that can be re-rendered as PDF, correct?

If so, you can use {% include %} and {% if %} within templates of Django. With these two template tags and context variables that are passed from view to template , you can validate a condition and include the footer dynamically in the pages that must have the same.

If this is not what you want you can try to edit the question, including more code examples, or even try to explain in a more direct way so that the community may be able to reproduce.

I hope I have helped!

    
30.01.2018 / 14:38