Skip to content

Commit f099a32

Browse files
committed
html: Updated docs for new table attributes
1 parent 86f2b74 commit f099a32

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/HTML.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ pdf.output("html.pdf")
8484
* `<ol>`, `<ul>`, `<li>`: ordered, unordered and list items (can be nested)
8585
* `<dl>`, `<dt>`, `<dd>`: description list, title, details (can be nested)
8686
* `<sup>`, `<sub>`: superscript and subscript text
87-
* `<table>`: (with `align`, `border`, `width` attributes)
87+
* `<table>`: (with `align`, `border`, `width`, `cellpadding`, `cellspacing` attributes)
8888
+ `<thead>`: optional tag, wraps the table header row
8989
+ `<tfoot>`: optional tag, wraps the table footer row
9090
+ `<tbody>`: optional tag, wraps the table rows with actual content
9191
+ `<tr>`: rows (with `align`, `bgcolor` attributes)
9292
+ `<th>`: heading cells (with `align`, `bgcolor`, `width` attributes)
93-
* `<td>`: cells (with `align`, `bgcolor`, `width` attributes)
93+
* `<td>`: cells (with `align`, `bgcolor`, `width`, `rowspan`, `colspan` attributes)
9494

9595

9696
## Known limitations

fpdf/html.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -566,15 +566,16 @@ def handle_starttag(self, tag, attrs):
566566
borders_layout = "NONE"
567567
align = attrs.get("align", "center").upper()
568568
padding = float(attrs["cellpadding"]) if "cellpadding" in attrs else None
569+
spacing = float(attrs.get("cellspacing", 0))
569570
self.table = Table(
570571
self.pdf,
571572
align=align,
572573
borders_layout=borders_layout,
573574
line_height=self.h * 1.30,
574575
width=width,
575576
padding=padding,
576-
gutter_width=float(attrs.get("cellspacing", 0)),
577-
gutter_height=float(attrs.get("cellspacing", 0)),
577+
gutter_width=spacing,
578+
gutter_height=spacing,
578579
)
579580
self._ln()
580581
if tag == "tr":

0 commit comments

Comments
 (0)