PDF Output Mode
Use -f pdf to generate a release-friendly PDF report.
What the PDF contains
The built-in PDF mode generates:
- A title page
- A table of contents with internal links
- An overview section with suite and test counters
- One section/page start per test suite with test case list
Basic command
testdoc -f pdf tests/ TestDocumentation.pdf
Custom PDF template
You can replace the default PDF HTML template with your own Jinja2 template:
testdoc -f pdf --custom-pdf-template path/to/pdf_template.html tests/ TestDocumentation.pdf
This works out of the box.
Mandatory template variables
Your template is rendered for two views: overview and suite.
Variables for view == "overview"
| Variable | Type | Description |
|---|---|---|
title |
str |
Report title |
generated_at |
str |
Generation date string |
suite_count |
int |
Number of included .robot suites |
test_count |
int |
Total number of test cases |
Variables for view == "suite"
| Variable | Type | Description |
|---|---|---|
suite_name |
str |
Current suite name |
tests |
list[dict] |
Test case collection for current suite |
Each item in tests contains:
| Key | Type | Description |
|---|---|---|
name |
str |
Test case name |
tags |
list[str] |
Tags for that test case (can be empty) |
Important behavior
- The title page is rendered directly by the PDF renderer, not by the custom Jinja template.
- The table of contents is rendered directly by the PDF renderer and includes clickable internal links.
- Your custom template is used for
overviewandsuiterendering only.
Configure in TOML
You can also configure custom PDF template usage in config files:
[tool.testdoc]
output_format = "pdf"
custom_pdf_template = "path/to/pdf_template.html"