Menu

Height of cell , WriteHTMLCell

Help
og75
2010-10-12
2012-10-09
  • og75

    og75 - 2010-10-12

    Hello,

    I'm creating a table in a pdf document with simple cells. Some cells content
    contains html tags. These cells are created using WriteHTMLCell. This works
    allmost fine except the height of the cell. If I load a svg file into the html
    cell the height of the cell don't fit the height of the other cells. Even if I
    have defined the same height for both, simple cells an htmlcells. This also
    happends if the height of the image is much lesser than its width ...

    How can I fix this ?

    Thanks in advance.

     
  • Nicola Asuni

    Nicola Asuni - 2010-10-12

    You can simply use the HTML tables for perfect alignment.
    Check the examples n. 6 and 61.

     
  • og75

    og75 - 2010-10-12

    I think I can't use HTML Tables because I have to insert some header data on
    each new page. The inserted data relates to the content of the new page. I
    tried to resolve this with a html table but it's much to complicated with the
    page breaks in comparison to the solution with the simple cells. The only
    problem is with the height of the html cells. I don't know the way to keep the
    height fixed ....

     
  • Nicola Asuni

    Nicola Asuni - 2010-10-12

    You can fix the multicell height by setting the same value for $h and $maxh.
    Be sure you are using the latast TCPDF version, check the example n. 5 and the
    documentation for Multicell().

     
  • og75

    og75 - 2010-10-12

    Ok I'm a little bit nearer to the solution. The height of the cell which I
    create with writehtmlcell is correct if the svg image I loaded in to the cell
    is very small scaled. If I scale the image bigger some kind of automatic line
    break apears in the writehtmlcell. Because of that the bottom of the cell
    moves down and does not longer fit the defined cell height.

    The problem which remains is, that the image which I have loaded into the
    writehtmlcell seams to have somekind of margin. or the cell some kind of
    padding. My Cell has a width of 9mm. But if the image has a width more than
    4mm the strange line break apears (see above). Because of that the image is
    much to small now.

    Call you please tell me a solution in the way that I can load the image with
    9mm width into the writehtmlcell which has also a 9mm width without having
    this automatic line break in the writehtmlcell ? Maybe I can ajust the padding
    of the writehtmlcell in some way ?

     
  • og75

    og75 - 2010-10-12

    Now I found a solution but its not very nice:

    $lastx = $this->getX();
    $lasty = $this->getY();
    $this->Rect( $lastx , $lasty, $cell, $cell);
    $this->writeHTML( $cell, 0);

    In this way I get a cell with a frame an the image in it and the frame fits in
    the defined height for cells.

    Maybe someone has a better solution ... ??

     

Log in to post a comment.