I spend way too much time manually calculating stats on a character sheet. There are stat calculation tools out there, but most of them are either too complex or don't fit my needs. I would still like to have a portable PDF without any fancy auto-calculating fields so that the character is fully customisable.
So why not have a script that handles the one-off calculations for me? :D
-
Fillable PDF of D&D character sheet - I recommend this version by TheWebCoder on Reddit.
Save the PDF as
character-sheet.pdfin the script working directory. -
Install Python 3.
-
Install
fillpdfPython package:pip install fillpdf
Prepare a JSON file with the character stats:
{
"level": <Character Level, int>,
"hit dice": <Hit Dice, int>,
"abilities": {
"STR": <Strength Score, int>,
"DEX": <Dexterity Score, int>,
"CON": <Constitution Score, int>,
"INT": <Intelligence Score, int>,
"WIS": <Wisdom Score, int>,
"CHA": <Charisma Score, int>
},
"proficiencies": [
<Proficiency #1, str>,
<Proficiency #2, str>,
<Proficiency #3, str>,
...
<Proficiency #N, str>
],
"spellbase": <Spellcaster Ability (Optional), str>
}
Note: Omit the spellbase key if the character is not a spellcaster.
On the command line, run the following command:
python3 dndfill.py -c <config.json> [-i <input.pdf>] -o output.pdfIf no input PDF file is provided, character-sheet.pdf will be used as default.
Note:
-
The calculations do not take into account race and class features that modify certain stats such as abilities, proficiencies, HP, etc.
-
The HP calculation for level 2 and above is given by the formula:
HP = (rolled OR average) + baseFor example:
HP = (2d8/10) + 14On the filled-in character sheet, pick either the rolled or average value and add to the base to get the final HP. The forward slash here is not a division.
JSON config file:
{
"level": 3,
"hit dice": 8,
"abilities": {
"STR": 10,
"DEX": 14,
"CON": 15,
"INT": 16,
"WIS": 13,
"CHA": 9
},
"proficiencies": [
"CON ST",
"INT ST",
"History",
"Investigation",
"Sleight of Hand",
"Perception"
],
"spellbase": "INT"
}
Output PDF:
To use a different character sheet or switch around certain fields, edit the
form-fields.json file. It contains the mapping of human-readable field names
to their corresponding field names in the fillable PDF.
To get the field names in a fillable PDF in Python:
from fillpdf import fillpdfs
fillpdfs.print_form_fields('character-sheet.pdf')