Create Table PDF
create_table_pdfTurn headers and row data into a ruled PDF table: column widths adjust to content, cells wrap, and the header repeats after page breaks.
Instructions
Create a ruled table PDF from headers and row data. Column widths are computed from the content, cells wrap, and the header row is redrawn after page breaks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | Natural language of the document (BCP 47, e.g. "ja" / "en-US"). When omitted with tagged, it is inferred from the text and the guess is reported in warnings. A wrong language declaration makes screen readers misread — state it explicitly when you know it. | |
| rows | Yes | Data rows. Each row is an array of strings; the same column count as headers is recommended. | |
| title | No | PDF title. Set in the metadata and also drawn as a heading at the top of the body. | |
| author | No | PDF author (metadata). | |
| margin | No | Margin on all sides (pt). Default 56 (about 20 mm). Range 0-300. | |
| tagged | No | Generate as a tagged PDF (PDF/UA-1, ISO 14289). Default false. When true, a structure tree, the PDF/UA declaration, /Lang and DisplayDocTitle are added, making the document readable by screen readers. PDF/UA requires a title, so title becomes required. | |
| headers | Yes | Header row (column titles). | |
| fontPath | No | Absolute path of the font file to embed (.ttf / .otf). Required for non-Latin text such as Japanese. .ttc (TrueType Collection) is not supported. Can also be set via the PDF_WRITER_FONT environment variable. | |
| fontSize | No | Body font size (pt). Default 11. Range 4-96. | |
| pageSize | No | Page size. Default A4. | |
| outputPath | No | Destination file path (absolute). When omitted, a base64 string is returned instead. | |
| pdfVersion | No | PDF version to output. Default "1.7". "2.0" (ISO 32000-2) satisfies not just the version claim but the duties bound to it: a trailer /ID is added (Required per Table 15), and the Info dictionary is trimmed to CreationDate / ModDate with title, author and Producer moved to XMP (§14.3.3). Cannot be combined with tagged: true (the only declaration the writer can produce is PDF/UA-1, built on PDF 1.7). | |
| returnBase64 | No | When true, include a base64 string in the result in addition to saving. | |
| onMissingGlyph | No | What to do with characters the font lacks (e.g. ✔ U+2714, missing from Noto Sans JP). error (default) = fail, listing the missing characters / replace = substitute 〓 with a warning / ignore = render as blanks with a warning. |