A style-based layout engine for generating professional legal documents. Transform Markdown, JSON, or plain text into polished PDFs, Word documents, or HTML previews with precise typography and layout control.
Quick example
import Casedev from 'casedev';
const client = new Casedev({ apiKey: 'sk_case_YOUR_API_KEY' });
const response = await client.format.v1.document({
content: '# Motion for Summary Judgment\n\nPlaintiff respectfully moves...',
input_format: 'md',
output_format: 'pdf',
options: {
template: 'pleading',
styles: {
h1: { font: 'Times New Roman', size: 14, bold: true, alignment: 'center' },
p: { font: 'Times New Roman', size: 12, spacingAfter: 12 }
}
}
});
Capabilities
Unlike simple converters, the Format API gives you full control over document presentation:
| Feature | Description |
|---|
| Typography | Control fonts, sizes, weights, and spacing per element type |
| Layout | Set margins, page numbers, headers, and footers |
| Templates | Built-in presets like pleading paper with line numbers |
| Variable Interpolation | Use {{variable}} placeholders for dynamic content |
| Preview Mode | Generate HTML previews before committing to PDF |
| Format | Use Case |
|---|
pdf | Final documents for filing, printing, or archiving |
docx | Editable Word documents for collaboration |
html_preview | Fast previews for UI rendering before final generation |
Built-in templates
| Template | Description |
|---|
standard | Clean professional formatting (default) |
pleading | Legal pleading paper with line numbers and court margins |
Custom templates can be saved and reused across your organization using the Templates API.
Endpoints
Common patterns
Live preview in your app
// Show users a preview before generating the final PDF
const preview = await client.format.v1.document({
content: markdownContent,
input_format: 'md',
output_format: 'html_preview'
});
// Render in your UI
document.getElementById('preview').innerHTML = preview;
With template variables
const contract = await client.format.v1.document({
content: `
# Service Agreement
This agreement is entered into by **{{client_name}}** ("Client")
and **{{firm_name}}** ("Firm") on {{effective_date}}.
## Scope of Services
{{services_description}}
`,
input_format: 'md',
output_format: 'pdf',
options: {
components: [{
variables: {
client_name: 'Acme Corporation',
firm_name: 'Smith & Associates LLP',
effective_date: 'January 15, 2024',
services_description: 'Legal representation in matters of...'
}
}]
}
});
Court-ready pleading
const motion = await client.format.v1.document({
content: motionMarkdown,
input_format: 'md',
output_format: 'pdf',
options: {
template: 'pleading',
header: 'SUPERIOR COURT OF CALIFORNIA',
footer: 'Motion for Summary Judgment - Page {{page}}',
margins: { top: 72, right: 72, bottom: 72, left: 108 }
}
});