Trouble setting letter size table height with or without image background

609 views
Skip to first unread message

Paulo Lopes

unread,
Oct 29, 2014, 5:58:10 PM10/29/14
to dom...@googlegroups.com
Hi Brian,

I have been trying everything I found in the web to fix this problem.
I conclude domPDF doesn't handle table height. Does it?

Attached is my code, in my case, it is a .php file because I am retrieving MySQL data to compose music performance programs.
Attached is also my excellent results, however if I have half of the data the external table border will follow the quantity of data.
In other words the border is following the quantity of data inside the table and I want it fixed by 11in height.

I tried to setup the border also with a table image background but didn't work as well.

What I need?
1. To have a "fixed" size 8.5 W X 11 H inches despite of how much data I have inside the inner table, I mean, when the first page is full it suppose to start a second page automatically.
2. Be able to start a second page (with header and empty body inside the borders, as attached example)

Please let me know if someone can help.

Many thanks in advanced,

Paulo Lopes


MY CSS FOR ALL TEMPLATES:

                <style type="text/css">
       
body {
        background: white;
        font-size: 12px;
        max-width: 740pt;
        font-family: pfd comp pro;
        margin: 0;
        padding: 0;
        blockquote: text-align: left;
       

    }
       
    table.Section1 {
    /* border-width: 3px;
    border-spacing: 0px;
    border-style: solid;
    border-color: black;*/
        text-align: right;

        max-width: 700px;
        width: 700px;
       
        /*max-height: 840px;
        height: 840px;*/
   
    }


    table.Section2  tr > td {
        padding: 0px 15px 0px;       
    }
   
    table.Section3  tr > td { /* FOOTER */
   
    font-family: 'pfd comp pro'; font-size: 9pt;
        padding: 0px;       
    }
   
    p:empty {
    width: 30px;
    height: 100%;
    background: #ffffff;
}


</style>

   
    <style type="text/css">
  @page { margin: 5px 32px 0px; }
            img {margin:0px 0px 3px;}
    size: A4 portrait;
</style>
BG-patern-dompdf_out-blank.pdf
BG-patern-dompdf_out.pdf
private_coord_RH_Hall.php

BrianS

unread,
Oct 30, 2014, 11:23:45 PM10/30/14
to dom...@googlegroups.com
I don't really have a good solution for this right now. dompdf's table handling code is a bit creaky and some things just aren't possible. For example, the size of a table cell is heavily influenced by it's contents. And specifying the height is not well-supported for table elements.

What you might try is creating a fixed-position div that defines the border. If your content area is consistent across pages this should work just fine. So you could set a top margin on the page, pull the header content into that margin, position the border div around the content area, then render your table as normal sans border.

Paulo Lopes

unread,
Nov 2, 2014, 5:12:44 PM11/2/14
to dom...@googlegroups.com, Sean Ferguson, Prof.
Hello Brian, first of all thanks for the domPDF genius application.
Second, I resolved the problem creating a div container but didn’t try a fixed position.
Here is the solution that worked well in my case and perhaps it can help someone.

<style>
.container {
    margin-left: auto !important;
    margin-right: auto !important;
   margin-top: 5px !important;
   margin-bottom: 0px !important;
    width: 710px;
height: 85% !important;
    background-color: #ffffff;
border: 3px black solid;
float: auto;
}
</style>

All My DIVs:

<div class="Section1" style="page-break-inside:avoid;”> (This stopped breaking the table in the middle)

<img src="../../images/RH-Header-pdf.jpg" alt="" border="0" align="center”> (header Image)

<!-- start of body table -->

<div class="container”>  (Border conteiner)

(MYSQL TABLE CONTENT GOES HERE)

<div class="clearfooter"></div>

</div> (Close container)

<!-- end of body table -->


<div class="footer" align="left" colspan="3" valign="bottom" style="font-family: 'pfd comp pro'; font-size: 10pt !important;
padding: 0px 0px 0px 12px;"><!-- start of footer --> [FOOTER] <!-- endof footer --></div> (Footer outside of the data container)

</div> (closes main Section1 div where the page suppose to break)

Question: How do I to break the page, loading an empty body table + header + footer code in the next page?
In other words, how can start a new empty page when the amount of data riches the stablished page and/or table height?

Many thanks,

Paulo Lopes





--
You received this message because you are subscribed to the Google Groups "dompdf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dompdf+un...@googlegroups.com.
To post to this group, send email to dom...@googlegroups.com.
Visit this group at http://groups.google.com/group/dompdf.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages