Menu

#764 htmlTOC alignment bug

v1.0_(example)
closed
nobody
None
1
2012-11-28
2012-11-28
No

When using the htmlTOC the alignment of the page numbers is weird whenever the number of digits is increased. So the alignment is off with "10" and again later with "100". It does not matter if the alignment is right or left. Below is the code i currently use for creating the TOC.

Code Snippet:

// A monospaced font for the page number is mandatory to get the right alignment
$bookmark_templates[0] =
    '<table border="0" cellpadding="0" cellspacing="0">' .
        '<tr>' .
            '<td width="165mm">#TOC_DESCRIPTION#</td>' .
            '<td width="15mm" style="text-align: right;">#TOC_PAGE_NUMBER#</td>' .
        '</tr>' .
    '</table>';
$bookmark_templates[1] =
    '<table border="0" cellpadding="0" cellspacing="0">' .
        '<tr>' .
            '<td width="5mm"> </td>' .
            '<td width="160mm">#TOC_DESCRIPTION#</td>' .
            '<td width="15mm" style="text-align: right;">#TOC_PAGE_NUMBER#</td>' .
        '</tr>' .
    '</table>';
$bookmark_templates[2] =
    '<table border="0" cellpadding="0" cellspacing="0">' .
        '<tr>' .
            '<td width="10mm"> </td>' .
            '<td width="155mm">#TOC_DESCRIPTION#</td>' .
            '<td width="15mm" style="text-align: right;">#TOC_PAGE_NUMBER#</td>' .
        '</tr>' .
    '</table>';
// add table of content at page 1
$pdf->addHTMLTOC(1, 'INDEX', $bookmark_templates, TRUE, 'B', array(128, 0, 0));
1 Attachments

Discussion

  • Nicola Asuni

    Nicola Asuni - 2012-11-28

    This is not a bug, please check the default documentation and examples and ask help on the help forum.

     
  • Nicola Asuni

    Nicola Asuni - 2012-11-28
    • status: open --> closed
     

Log in to post a comment.