This project is a simple D&D spell card generator. The online editor is here.
⚠️ There may be some text extraction errors, so please review them before using.
The DNDSpellCards is the main class for generating spell cards. The spells are an Array following spell structure. nodeElement is the target DOM element where the PDF preview (iframe) will be added.
The function returns a PDFDocument.
const doc = DNDSpellCards.CreatePDF( spells, nodeElement );
/// open a new window - can be block popup
doc.open();
/// download pdf file
doc.download( "file-name" );The DNDSpellCards accepts the following spell structure:
{
"name": "...",
"type": "...",
"casting": "...",
"range": "...",
"components": "...",
"duration": "...",
"level": "...",
"classes": [
"...",
"..."
],
"content": [
"Paragraph ...",
"Paragraph ...",
"Paragraph ... $Bold And Italic$ ..."
],
"tables": [{
"sizes": [ 0.25, 0.75 ],
"header": [
[ "#title#", "#title#" ]
],
"body": [
["td ...", "td ..."],
["td ...", "td ..."],
["td ...", "td ..."]
]
}],
"statblock": {
"title": "...",
"subtitle": "...",
"AC": "..",
"HP": "...",
"Speed": "...",
"attributes": {
"STR": ["0", "+0", "+0"],
"DEX": ["0", "+0", "+0"],
"CON": ["0", "+0", "+0"],
"INT": ["0", "-0", "-0"],
"WIS": ["0", "-0", "-0"],
"CHA": ["0", "-0", "-0"]
},
"addons": {
"Immunities": "...",
"Senses": "...",
"Languages": "...",
"CR": "..."
},
"Actions": [
"Paragraph ..."
]
}| Syntax | Style |
|---|---|
| TEXT | Normal |
#TEXT# |
Bold |
_TEXT_ |
Italic |
$TEXT$ |
Bold + Italic |
The editor has been built with Vue.js.
cd editor/
npm installnpm run buildnpm run preview