Use master template style (Arial 11pt, justified, 1.5 spacing) for appointment letter PDF
This commit is contained in:
parent
efa4331b99
commit
4066c1c43c
3 changed files with 152 additions and 77 deletions
|
|
@ -89,53 +89,76 @@ export async function PATCH(
|
|||
// ─── Signed-letter PDF via daemon ─────────────────────────────────────────
|
||||
|
||||
function signedLetterHtml(directorName: string, companyName: string, date: string, signatureBase64: string): string {
|
||||
// Same master template style as the initial letter (Arial 11, justified, 1.5 spacing,
|
||||
// formal SA Companies Act wording), with the captured signature embedded.
|
||||
return `<!DOCTYPE html>
|
||||
<html><head><meta charset="utf-8"><title>Signed Letter of Appointment</title>
|
||||
<html><head><meta charset="utf-8"><title>Letter of Appointment as Director</title>
|
||||
<style>
|
||||
@page { size: A4; margin: 25mm; }
|
||||
body { font-family: Arial, sans-serif; font-size: 11pt; color: #111; line-height: 1.5; }
|
||||
h1 { text-align: center; font-size: 14pt; margin: 0 0 6pt; }
|
||||
h2 { font-size: 11pt; margin: 14pt 0 4pt; border-bottom: 1px solid #333; padding-bottom: 2pt; }
|
||||
p { margin: 6pt 0; text-align: justify; }
|
||||
.meta { font-size: 10pt; color: #444; margin-bottom: 18pt; }
|
||||
.sig-block { margin-top: 28pt; border-top: 1px solid #000; padding-top: 8pt; width: 60%; }
|
||||
.sig-img { height: 70pt; display: block; margin: 4pt 0; }
|
||||
.sig-name { font-weight: bold; }
|
||||
.sig-role { color: #555; font-size: 10pt; }
|
||||
.footer { margin-top: 32pt; font-size: 9pt; color: #666; text-align: center; }
|
||||
body { font-family: Arial, sans-serif; font-size: 11pt; color: #000; line-height: 1.5; text-align: justify; margin: 0; }
|
||||
h1 { font-family: Arial, sans-serif; font-size: 13pt; font-weight: bold; color: #0a1a3a; text-align: center;
|
||||
margin: 0 0 6pt; padding: 0 0 6pt; border-bottom: 2px solid #0a1a3a; }
|
||||
.right { text-align: right; }
|
||||
.left { text-align: left; }
|
||||
.director-block { margin-top: 16pt; margin-bottom: 12pt; }
|
||||
.director-name { font-weight: bold; color: #0a1a3a; font-size: 11pt; }
|
||||
.director-line { color: #222; font-size: 10pt; }
|
||||
.addressee-block { margin: 12pt 0 12pt 0; }
|
||||
.addressee-name { font-weight: bold; }
|
||||
.salutation { margin: 8pt 0 12pt 0; }
|
||||
p { margin: 6pt 0; }
|
||||
.signature-block { margin-top: 32pt; }
|
||||
.sig-img { height: 60pt; display: block; margin: 8pt 0; }
|
||||
.sig-name { font-weight: bold; font-size: 11pt; margin-top: 4pt; }
|
||||
.sig-role { color: #444; font-size: 10pt; }
|
||||
.footer { margin-top: 24pt; font-size: 9pt; color: #555; text-align: center; font-style: italic; }
|
||||
</style></head>
|
||||
<body>
|
||||
<h1>SIGNED LETTER OF APPOINTMENT AS DIRECTOR</h1>
|
||||
<p class="meta">Date: ${date}</p>
|
||||
|
||||
<p><strong>To:</strong> All Directors and the Company Secretary</p>
|
||||
<p><strong>Re:</strong> Acceptance of Director Appointment — <em>${companyName}</em></p>
|
||||
<h1>LETTER OF APPOINTMENT AS DIRECTOR</h1>
|
||||
|
||||
<h2>1. Confirmation</h2>
|
||||
<p>
|
||||
We are pleased to confirm that <strong>${directorName}</strong> has accepted the
|
||||
appointment as a Director of <strong>${companyName}</strong>.
|
||||
</p>
|
||||
<div class="right" style="margin-top: 14pt;">
|
||||
<span class="director-line">${date}</span>
|
||||
</div>
|
||||
|
||||
<h2>2. Acceptance</h2>
|
||||
<p>
|
||||
The acceptance was received on <strong>${date}</strong> and is hereby recorded in
|
||||
terms of section 70 of the Companies Act 71 of 2008.
|
||||
</p>
|
||||
<div class="director-block right">
|
||||
<div class="director-name">${directorName}</div>
|
||||
</div>
|
||||
|
||||
<h2>3. Signature</h2>
|
||||
<p>The Director's acceptance is evidenced by the signature below:</p>
|
||||
<div class="addressee-block left">
|
||||
<div class="addressee-name">The Board of Directors and Company Secretary</div>
|
||||
<div>${companyName}</div>
|
||||
</div>
|
||||
|
||||
<div class="sig-block">
|
||||
<img class="sig-img" src="data:image/png;base64,${signatureBase64}" alt="Signature"/>
|
||||
<p class="sig-name">${directorName}</p>
|
||||
<p class="sig-role">Director — ${companyName}</p>
|
||||
</div>
|
||||
<div class="salutation">Dear Members of the Board</div>
|
||||
|
||||
<p>
|
||||
We are pleased to confirm that <strong>${directorName}</strong> has accepted the appointment as a
|
||||
Director of <strong>${companyName}</strong> in terms of the company's Memorandum of Incorporation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The acceptance was received on <strong>${date}</strong> and is hereby recorded in terms of
|
||||
section 70 of the Companies Act 71 of 2008 (the “Act”).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The Director's acceptance is evidenced by the signature reproduced below. A signed copy of this
|
||||
letter is filed with the Company Secretary.
|
||||
</p>
|
||||
|
||||
<p>Yours faithfully,</p>
|
||||
|
||||
<div class="signature-block">
|
||||
<img class="sig-img" src="data:image/png;base64,${signatureBase64}" alt="Signature"/>
|
||||
<div class="sig-name">${directorName}</div>
|
||||
<div class="sig-role">Director — ${companyName}</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
Filed in terms of the Companies Act 71 of 2008
|
||||
</div>
|
||||
|
||||
<p class="footer">
|
||||
Filed by the Board of Directors — ${companyName}<br/>
|
||||
Section 70, Companies Act 71 of 2008
|
||||
</p>
|
||||
</body></html>`;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,58 +82,110 @@ export async function POST(req: NextRequest) {
|
|||
|
||||
// ─── Letter HTML → PDF via daemon ─────────────────────────────────────────
|
||||
|
||||
function letterHtml(directorName: string, companyName: string, signUrl: string): string {
|
||||
function letterHtml(opts: {
|
||||
directorName: string;
|
||||
companyName: string;
|
||||
signUrl: string;
|
||||
signatureBase64?: string;
|
||||
letterDate?: string;
|
||||
}): string {
|
||||
const { directorName, companyName, signUrl, signatureBase64, letterDate } = opts;
|
||||
const today = new Date().toISOString().split("T")[0];
|
||||
const date = letterDate || today;
|
||||
|
||||
// Master template style (per SJ 2026-07-22, matches the resignation letter):
|
||||
// - No logo / no letterhead (formal SA legal style)
|
||||
// - Arial 11pt body, justified, 1.5 line spacing
|
||||
// - "LETTER OF APPOINTMENT AS DIRECTOR" header (Arial 13pt bold, navy bottom border)
|
||||
// - Director details block top-right
|
||||
// - Addressee block left
|
||||
// - Salutation: "Dear <Director full name>"
|
||||
// - Body references Companies Act 71 of 2008
|
||||
// - Signature block at bottom with printed name + ID Number
|
||||
return `<!DOCTYPE html>
|
||||
<html><head><meta charset="utf-8"><title>Letter of Appointment as Director</title>
|
||||
<style>
|
||||
@page { size: A4; margin: 25mm; }
|
||||
body { font-family: Arial, sans-serif; font-size: 11pt; color: #111; line-height: 1.5; }
|
||||
h1 { text-align: center; font-size: 14pt; margin: 0 0 6pt; }
|
||||
h2 { font-size: 11pt; margin: 14pt 0 4pt; border-bottom: 1px solid #333; padding-bottom: 2pt; }
|
||||
p { margin: 6pt 0; text-align: justify; }
|
||||
.meta { font-size: 10pt; color: #444; margin-bottom: 18pt; }
|
||||
.sign-line { margin-top: 28pt; border-top: 1px solid #000; width: 50%; padding-top: 4pt; font-size: 10pt; color: #555; }
|
||||
.footer { margin-top: 32pt; font-size: 9pt; color: #666; text-align: center; }
|
||||
body { font-family: Arial, sans-serif; font-size: 11pt; color: #000; line-height: 1.5; text-align: justify; margin: 0; }
|
||||
h1 { font-family: Arial, sans-serif; font-size: 13pt; font-weight: bold; color: #0a1a3a; text-align: center;
|
||||
margin: 0 0 6pt; padding: 0 0 6pt; border-bottom: 2px solid #0a1a3a; }
|
||||
.right { text-align: right; }
|
||||
.left { text-align: left; }
|
||||
.director-block { margin-top: 16pt; margin-bottom: 12pt; }
|
||||
.director-name { font-weight: bold; color: #0a1a3a; font-size: 11pt; }
|
||||
.director-line { color: #222; font-size: 10pt; }
|
||||
.addressee-block { margin: 12pt 0 12pt 0; }
|
||||
.addressee-name { font-weight: bold; }
|
||||
.salutation { margin: 8pt 0 12pt 0; }
|
||||
p { margin: 6pt 0; }
|
||||
.signature-block { margin-top: 32pt; }
|
||||
.sig-line { border-top: 1px solid #000; padding-top: 4pt; width: 60%; margin-top: 24pt; }
|
||||
.sig-name { font-weight: bold; font-size: 11pt; margin-top: 4pt; }
|
||||
.sig-role { color: #444; font-size: 10pt; }
|
||||
.sig-img { height: 60pt; display: block; margin: 8pt 0; }
|
||||
.footer { margin-top: 24pt; font-size: 9pt; color: #555; text-align: center; font-style: italic; }
|
||||
.sign-link-box { margin: 12pt 0; padding: 8pt; background: #f4f4f4; border: 1px solid #ccc;
|
||||
font-family: monospace; font-size: 9pt; text-align: left; word-break: break-all; }
|
||||
</style></head>
|
||||
<body>
|
||||
<h1>LETTER OF APPOINTMENT AS DIRECTOR</h1>
|
||||
<p class="meta">Date: ${new Date().toISOString().split("T")[0]}</p>
|
||||
|
||||
<p><strong>To:</strong> ${directorName}</p>
|
||||
<h1>LETTER OF APPOINTMENT AS DIRECTOR</h1>
|
||||
|
||||
<h2>1. Appointment</h2>
|
||||
<p>
|
||||
We are pleased to inform you that you have been appointed as a Director of
|
||||
<strong>${companyName}</strong> in terms of the company's Memorandum of Incorporation.
|
||||
</p>
|
||||
<div class="right" style="margin-top: 14pt;">
|
||||
<span class="director-line">${date}</span>
|
||||
</div>
|
||||
|
||||
<h2>2. Acceptance Required</h2>
|
||||
<p>
|
||||
Your appointment is subject to your formal acceptance in terms of section 70 of the
|
||||
Companies Act 71 of 2008. Until your acceptance is received, your appointment is not
|
||||
complete.
|
||||
</p>
|
||||
<div class="director-block right">
|
||||
<div class="director-name">${directorName}</div>
|
||||
</div>
|
||||
|
||||
<h2>3. How to Accept</h2>
|
||||
<p>
|
||||
Please accept your appointment and provide your signature by visiting the following
|
||||
secure link:
|
||||
</p>
|
||||
<p style="text-align:center; font-family: monospace; font-size: 10pt; padding: 8pt; background:#f4f4f4; border:1px solid #ddd;">
|
||||
${signUrl}
|
||||
</p>
|
||||
<div class="addressee-block left">
|
||||
<div class="addressee-name">The Board of Directors</div>
|
||||
<div>${companyName}</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Alternatively, you may print and sign this letter and return the signed copy to the
|
||||
company secretary.
|
||||
</p>
|
||||
<div class="salutation">Dear ${directorName}</div>
|
||||
|
||||
<div class="sign-line">Director (to sign on acceptance)</div>
|
||||
<p>
|
||||
We are pleased to confirm that you have been appointed as a Director of <strong>${companyName}</strong>
|
||||
in terms of the company’s Memorandum of Incorporation. Your appointment takes effect from the date of
|
||||
this letter and is subject to your formal acceptance in terms of section 70 of the Companies Act 71 of 2008
|
||||
(the “Act”).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Until your acceptance is received, your appointment is not complete. We kindly request that you signify
|
||||
your acceptance by signing and returning a copy of this letter, or by accepting electronically via the
|
||||
secure link provided below.
|
||||
</p>
|
||||
|
||||
<p>To accept your appointment electronically, please visit the following secure link:</p>
|
||||
|
||||
<div class="sign-link-box">${signUrl}</div>
|
||||
|
||||
<p>
|
||||
Alternatively, you may print this letter, sign in the space provided below, and return the signed copy
|
||||
to the Company Secretary at the company’s registered address.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Your duties and responsibilities as a Director are set out in the Act, the company’s Memorandum of
|
||||
Incorporation, and any applicable board charter. We look forward to your valued contribution to the
|
||||
governance and growth of the company.
|
||||
</p>
|
||||
|
||||
<p>Yours faithfully,</p>
|
||||
|
||||
<div class="signature-block">
|
||||
${signatureBase64 ? `<img class="sig-img" src="data:image/png;base64,${signatureBase64}" alt="Signature"/>` : `<div class="sig-line"> </div>`}
|
||||
<div class="sig-name">${directorName}</div>
|
||||
<div class="sig-role">Director</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
Issued in terms of the Companies Act 71 of 2008
|
||||
</div>
|
||||
|
||||
<p class="footer">
|
||||
Issued by the Board of Directors — ${companyName}<br/>
|
||||
Section 70, Companies Act 71 of 2008
|
||||
</p>
|
||||
</body></html>`;
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +216,7 @@ async function sendAppointmentEmail(opts: {
|
|||
const subject = `[${directorName}] Acceptance letter as director for ${companyName}`;
|
||||
|
||||
// 1. Generate PDF via daemon
|
||||
const html = letterHtml(directorName, companyName, signUrl);
|
||||
const html = letterHtml({ directorName, companyName, signUrl });
|
||||
let pdfBytes: Buffer | null = null;
|
||||
let pdfFilename = `acceptance-letter-${Date.now()}.pdf`;
|
||||
try {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue