Skip to content

Commit

Permalink
html: Updated docs for new table attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mjasperse committed Jan 3, 2024
1 parent 86f2b74 commit f099a32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/HTML.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ pdf.output("html.pdf")
* `<ol>`, `<ul>`, `<li>`: ordered, unordered and list items (can be nested)
* `<dl>`, `<dt>`, `<dd>`: description list, title, details (can be nested)
* `<sup>`, `<sub>`: superscript and subscript text
* `<table>`: (with `align`, `border`, `width` attributes)
* `<table>`: (with `align`, `border`, `width`, `cellpadding`, `cellspacing` attributes)
+ `<thead>`: optional tag, wraps the table header row
+ `<tfoot>`: optional tag, wraps the table footer row
+ `<tbody>`: optional tag, wraps the table rows with actual content
+ `<tr>`: rows (with `align`, `bgcolor` attributes)
+ `<th>`: heading cells (with `align`, `bgcolor`, `width` attributes)
* `<td>`: cells (with `align`, `bgcolor`, `width` attributes)
* `<td>`: cells (with `align`, `bgcolor`, `width`, `rowspan`, `colspan` attributes)


## Known limitations
Expand Down
5 changes: 3 additions & 2 deletions fpdf/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,15 +566,16 @@ def handle_starttag(self, tag, attrs):
borders_layout = "NONE"
align = attrs.get("align", "center").upper()
padding = float(attrs["cellpadding"]) if "cellpadding" in attrs else None
spacing = float(attrs.get("cellspacing", 0))
self.table = Table(
self.pdf,
align=align,
borders_layout=borders_layout,
line_height=self.h * 1.30,
width=width,
padding=padding,
gutter_width=float(attrs.get("cellspacing", 0)),
gutter_height=float(attrs.get("cellspacing", 0)),
gutter_width=spacing,
gutter_height=spacing,
)
self._ln()
if tag == "tr":
Expand Down

0 comments on commit f099a32

Please sign in to comment.