Skip to content

jspdf-md-rendererMarkdown ⇢ PDF

Generate beautifully formatted PDFs directly from Markdown. Zero config, works in browser and Node.js.

jspdf-md-rendererjspdf-md-renderer
npm versionDownloadsLicense: MITGitHub Stars

Quick Start

bash
npm install jspdf-md-renderer
ts
import { 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')

Supported Elements

ElementSyntaxStatus
Headings# H1 to ###### H6
ParagraphsPlain text
Bold / Italic**bold** / *italic*
Lists- unordered, 1. ordered, nested
Links[text](url)
Images![alt](url){width=200 align=center}
TablesGFM pipe tables
Code BlocksFenced ` ``` ` blocks
Inline Code`` `code` ``
Blockquotes> quote
Horizontal Rules---

Released under the MIT License.