mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
62 lines
1.3 KiB
TypeScript
62 lines
1.3 KiB
TypeScript
import { IDocProps } from '../interfaces/IDocProps'
|
|
|
|
function convertLineBreaks(lines: string) {
|
|
return lines.replace(/\n/g, '\\\\')
|
|
}
|
|
|
|
export function brief(options: IDocProps) {
|
|
const {
|
|
template = 'brief-fam',
|
|
subject = '',
|
|
yourRef = '',
|
|
yourRefName = 'Ihr Zeichen',
|
|
yourMail = '',
|
|
myRef = '',
|
|
customer = '',
|
|
invoice = '',
|
|
date = '\\today',
|
|
signature = '',
|
|
specialMail = '',
|
|
address = 'Max Mustermann\\\\Musterstrasse\\\\12345 Musterstadt',
|
|
opening = 'Sehr geehrte Damen und Herren',
|
|
body = '',
|
|
closing = 'Mit freundlichen Grüßen',
|
|
ps = '',
|
|
enclosing = '',
|
|
} = { ...options }
|
|
|
|
return `% brief document
|
|
\\documentclass{scrlttr2}
|
|
\\LoadLetterOption{${template}}
|
|
|
|
\\setkomavar{subject}{${subject}}
|
|
|
|
\\setkomavar{yourref}[${yourRefName}]{${yourRef}}
|
|
\\setkomavar{yourmail}{${yourMail}}
|
|
\\setkomavar{myref}{${myRef}}
|
|
\\setkomavar{customer}{${customer}}
|
|
\\setkomavar{invoice}{${invoice}}
|
|
|
|
\\setkomavar{date}{${date}}
|
|
|
|
%\\setkomavar{signature}{${signature}}
|
|
|
|
\\setkomavar{specialmail}{${specialMail}}
|
|
|
|
\\begin{document}
|
|
\\begin{letter}{${convertLineBreaks(address)}}
|
|
|
|
\\opening{${opening},}
|
|
|
|
${convertLineBreaks(body)}
|
|
|
|
\\closing{${closing}}
|
|
|
|
\\ps{${ps}}
|
|
|
|
%\\encl{${enclosing}}
|
|
|
|
\\end{letter}
|
|
\\end{document}`
|
|
}
|