Zero Config
Sensible defaults out of the box β just pass markdown and get a beautifully formatted PDF. No setup required.
Generate beautifully formatted PDFs directly from Markdown. Zero config, works in browser and Node.js.
npm install jspdf-md-rendererimport { jsPDF } from 'jspdf'
import { MdTextRender } from 'jspdf-md-renderer'
const doc = new jsPDF()
await MdTextRender(doc, '# Hello World\n\nRendered with **jspdf-md-renderer**!', {
cursor: { x: 10, y: 10 },
page: {
maxContentWidth: 190,
maxContentHeight: 277,
lineSpace: 1.5,
defaultLineHeightFactor: 1.2,
defaultFontSize: 12,
defaultTitleFontSize: 14,
topmargin: 10,
xpading: 10,
xmargin: 10,
indent: 10
},
font: {
bold: { name: 'helvetica', style: 'bold' },
regular: { name: 'helvetica', style: 'normal' },
light: { name: 'helvetica', style: 'light' }
},
endCursorYHandler: (y) => console.log('Ended at Y:', y),
})
doc.save('output.pdf')| Element | Syntax | Status |
|---|---|---|
| Headings | # H1 to ###### H6 | β |
| Paragraphs | Plain text | β |
| Line Breaks | <br> tags | β |
| Bold / Italic | **bold** / *italic* | β |
| Lists | - unordered, 1. ordered, nested | β |
| Links | [text](url) | β |
| Images | {width=200 align=center} | β |
| Tables | GFM pipe tables | β |
| Code Blocks | Fenced ` ``` ` blocks | β |
| Inline Code | `` `code` `` | β |
| Blockquotes | > quote | β |
| Horizontal Rules | --- | β |