Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
218 Visualizzazioni

Hello Everyone,


​Page 1 ​ ​ ​ ​ ​​​Page 2


##################              ##################

#                                    #             #                            ​    ​   #

#        HEADER              #             #         HEADER             # 

#                                    #             #                            ​         #

################## ​ ​ ​##################

#                                    #             #            ​ ​   ​   ​#

#        ARTICLE             #             #        ARTICLE              #       

#                                    #             #                            ​  ​   #

#                                    #             #                              ​      #

#                                    #             #                              ​      #

#                                    #             #                            ​        #

#                                    #             #                              ​      # 

################## ​ ​​##################

#        {blank_space}    # ​ ​​#         Sign Here          #

#    ​ ​ ​ ​   # Footer ​#    ​ ​ ​ ​  # #​ ​  ​#

#       Page number       # ​ ​ ​#       Page number      #

################## ​ ​ ​##################


Here's my Footer

i apply this report_qweb_element_page_visibility oca module 

so my sign section only appear on last page


My problem is the blank space on the first page is there anyway to have dynamic footer height or ( move my signing section to article and make it appear before footer even though my article on the 2nd page only have 1 line of content )
odoo 18


I'm really confuse with wkhtmltopdf 

Please Help, Thank !


​           <div class="footer">

                        <div class="last-page" name="Signing Section">

                            <p>____ Person 1____</p>

                            <p>____ Sign Here ____</p>

                            <p>____ Person 2____</p>

                            <p>____ Sign Here ____</p>

                            <p>____ Person 3____</p>

                            <p>____ Sign Here ____</p>

                            <p>____ Person 4____</p>

                            <p>____ Sign Here ____</p>

                        </div>


                        <div name="display-page-number">

                            Page <span class="page"/> of <span class="topage"/>

                        </div>

                    </div>



Avatar
Abbandona
Risposta migliore

Hi,


It’s really a wkhtmltopdf limitation in Odoo QWeb reports rather than just a CSS issue.


- In Odoo reports, the footer section is fixed-height across all pages (wkhtmltopdf requirement).

- When you use the OCA report_qweb_element_page_visibility module to only show the sign block on the last page, that empty “reserved space” in the footer still exists on all pages, even when hidden,  because wkhtmltopdf allocates it at rendering time.

-That’s why you see the big blank space on page 1, even though the sign area is invisible.


wkhtmltopdf treats the header/footer as static templates, separate from the main content flow.

So the footer height is determined by the tallest footer across all pages. If your last page footer is large (signatures), that height is applied to every page.


Possible solution.


1- Move the signature block into the main body


    Instead of putting the signature in the <div class="footer">, you:

          - Place it in the article/content area.

          - Use report_qweb_element_page_visibility to display it only on the last page.

          - This way, the footer stays small, and the signature’s height does not affect earlier pages.

          - Eg :- <div class="article">

    <!-- your main content -->


    <div class="last-page" name="sign-section">

        <p>____ Person 1 ____</p>

        <p>____ Sign Here ____</p>

        ...

    </div>

</div>


<div class="footer">

    <div name="display-page-number">

        Page <span class="page"/> of <span class="topage"/>

    </div>

</div>


2- Use two different footers

           You can define two footers in QWeb and tell wkhtmltopdf:

         -  Use short footer for all pages except last.

        -   Use tall footer with signatures for the last page.


Hope it helps.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
7
feb 19
6405
1
feb 24
3121
3
mag 24
3206
1
set 19
7679
1
mag 19
9708