dmd-to-pdf
v1.0.5
Published
DMD - Document Markdown to PDF. A specialized markdown language for generating professional PDFs.
Maintainers
Readme
DMD - Document Markdown
A specialized markdown language for generating professional PDF documents. DMD extends markdown with powerful features for document layout, styling, and formatting.
Installation
Requirements: pdfmake 0.3.5 or higher
npm install dmd-to-pdf [email protected]CDN (Browser):
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/pdfmake.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dmd-to-pdf/dist/dmd.umd.js"></script>Quick Start
Browser:
// DMD is available as global after loading the script
const document = `
:::config
title: My Document
author: John Doe
:::
# Hello World
This is a **DMD** document with *rich formatting*.
## Features
- Simple markdown syntax
- Professional PDF output
- Tables, lists, and more
`;
// Generate PDF
const pdfBlob = await DMD.createPdf(document);Node.js:
// Setup pdfmake
const pdfmake = require('pdfmake');
const vfsFonts = require('pdfmake/build/vfs_fonts');
pdfmake.vfs = vfsFonts.pdfMake.vfs;
// Import DMD
const DMD = require('dmd-to-pdf');
const pdfBuffer = await DMD.createPdf('# Hello World');Free vs Pro Features
| Feature | Free | Pro |
|---------|:----:|:---:|
| Basic markdown (headings, text, lists) | ✓ | ✓ |
| Document config (title, margins, page size) | ✓ | ✓ |
| Basic tables | ✓ | ✓ |
| Multi-column layouts | ✓ | ✓ |
| Images & SVG | ✓ | ✓ |
| Links | ✓ | ✓ |
| Headers & footers | ✓ | ✓ |
| Inline styling [text]{::style} | ✓ | ✓ |
| Custom fonts (non-Roboto) | - | ✓ |
| Watermarks | - | ✓ |
| Background layers | - | ✓ |
| Table of contents & bookmarks | - | ✓ |
| QR codes | - | ✓ |
| Block styling ::style-name | - | ✓ |
| Table/list/column styling | - | ✓ |
Enabling Pro Features
// Set your license key to enable Pro features
const result = await DMD.setLicense('DMD-XXXX-XXXX-XXXX-XXXX');
if (result.valid) {
console.log('Pro features enabled!');
}Get a license at dmdlang.dev/pricing
API Reference
DMD.createPdf(source, format?)
Generate a PDF from DMD source.
source- DMD formatted stringformat- Output format:'blob'(default),'base64','dataUrl','buffer'(Node.js)
DMD.extractConfig(source)
Extract metadata and config without generating PDF.
DMD.loadImages(imageMap)
Preload images for better performance.
await DMD.loadImages({
logo: 'https://example.com/logo.png',
banner: '/images/banner.jpg'
});DMD.loadFonts(fontMap)
Load custom fonts. (Pro)
await DMD.loadFonts({
'MyFont': {
normal: 'https://example.com/font.ttf',
bold: 'https://example.com/font-bold.ttf'
}
});DMD.setLicense(key)
Set and validate a license key.
DMD.isPro()
Check if Pro features are enabled.
See full API documentation at DMD_API.md
DMD Syntax
:::config
title: Document Title
author: Author Name
pageSize: A4
pageMargins: [40, 60, 40, 60]
:::
:::styles
title:
fontSize: 24
bold: true
color: "#333333"
:::
# [Document Title]{::title}
Regular paragraph with **bold** and *italic* text.
## Lists
- Item one
- Item two
- Nested item
## Tables
::table
Name | Age | City
Alice | 30 | New York
Bob | 25 | London
::
## Links
[Visit our website]{url: https://dmdlang.dev}
## Images
[Company Logo]{img: logo}Documentation
- Website: dmdlang.dev
- Playground: dmdlang.dev/#playground
- API Reference: DMD_API.md
- LLM Context: dmdlang.dev/llms.txt
License
This software is proprietary. See LICENSE for details.
- Free Features: Available for personal and commercial use
- Pro Features: Require a valid license key
Copyright (c) 2026-present JSA DESENVOLVIMENTO DE SOFTWARES LTDA. All rights reserved.
