Skip to content

The Open Source DocuSign Alternative.

feat: add envelope ids to certs (#2733)

David Nguyen2c7a1be0516f
diff --git a/packages/lib/server-only/pdf/generate-certificate-pdf.ts b/packages/lib/server-only/pdf/generate-certificate-pdf.ts
index 4fa66d78f..bb52d4996 100644
--- a/packages/lib/server-only/pdf/generate-certificate-pdf.ts
+++ b/packages/lib/server-only/pdf/generate-certificate-pdf.ts
@@ -142,6 +142,7 @@ export const generateCertificatePdf = async (options: GenerateCertificatePdfOpti
};
}),
envelopeOwner,
+ envelopeId: envelope.id,
qrToken: envelope.qrToken,
hidePoweredBy: organisationClaim.flags.hidePoweredBy ?? false,
pageWidth,
diff --git a/packages/lib/server-only/pdf/render-audit-logs.ts b/packages/lib/server-only/pdf/render-audit-logs.ts
index 8ff5ffde5..0a6f73789 100644
--- a/packages/lib/server-only/pdf/render-audit-logs.ts
+++ b/packages/lib/server-only/pdf/render-audit-logs.ts
@@ -57,7 +57,7 @@ const textXs = 8;
const fontMedium = '500';
const pageTopMargin = 60;
-const pageBottomMargin = 15;
+const pageBottomMargin = 27;
const contentMaxWidth = 768;
const rowPadding = 10;
const titleFontSize = 18;
@@ -595,7 +595,7 @@ export async function renderAuditLogs({
const groupedRows = groupRowsIntoPages({
auditLogs,
- maxHeight: pageHeight,
+ maxHeight: pageHeight - pageBottomMargin,
contentWidth,
i18n,
overviewCard,
@@ -622,6 +622,16 @@ export async function renderAuditLogs({
stage.destroyChildren();
const page = new Konva.Layer();
+ const footerText = new Konva.Text({
+ x: margin,
+ y: pageHeight - textXs - 10,
+ text: `${i18n._(msg`Envelope ID`)}: ${envelope.id}`,
+ fontFamily: 'Inter',
+ fontSize: textXs,
+ fill: textMutedForegroundLight,
+ });
+ page.add(footerText);
+
page.add(pageGroup);
// Add branding on the last page if there is space.
@@ -657,6 +667,16 @@ export async function renderAuditLogs({
y: pageTopMargin,
} satisfies Partial<Konva.GroupConfig>);
+ const overflowFooterText = new Konva.Text({
+ x: margin,
+ y: pageHeight - textXs - 10,
+ text: `${i18n._(msg`Envelope ID`)}: ${envelope.id}`,
+ fontFamily: 'Inter',
+ fontSize: textXs,
+ fill: textMutedForegroundLight,
+ });
+ page.add(overflowFooterText);
+
page.add(brandingGroup);
stage.add(page);
diff --git a/packages/lib/server-only/pdf/render-certificate.ts b/packages/lib/server-only/pdf/render-certificate.ts
index 32c7556c0..330b457d2 100644
--- a/packages/lib/server-only/pdf/render-certificate.ts
+++ b/packages/lib/server-only/pdf/render-certificate.ts
@@ -49,6 +49,7 @@ export type CertificateRecipient = {
type GenerateCertificateOptions = {
recipients: CertificateRecipient[];
+ envelopeId: string;
qrToken: string | null;
hidePoweredBy: boolean;
i18n: I18n;
@@ -88,7 +89,7 @@ const columnWidthPercentages = [30, 30, 40];
const rowPadding = 12;
const tableHeaderHeight = 38;
const pageTopMargin = 72;
-const pageBottomMargin = 12;
+const pageBottomMargin = 24;
const contentMaxWidth = 768;
const titleFontSize = 18;
@@ -717,6 +718,7 @@ const renderTables = (options: RenderTablesOptions) => {
export async function renderCertificate({
recipients,
+ envelopeId,
qrToken,
hidePoweredBy,
i18n,
@@ -802,6 +804,16 @@ export async function renderCertificate({
}
}
+ const footerText = new Konva.Text({
+ x: margin,
+ y: pageHeight - textXs - 10,
+ text: `${i18n._(msg`Envelope ID`)}: ${envelopeId}`,
+ fontFamily: 'Inter',
+ fontSize: textXs,
+ fill: textMutedForegroundLight,
+ });
+ page.add(footerText);
+
page.add(group);
stage.add(page);
@@ -820,6 +832,16 @@ export async function renderCertificate({
y: pageTopMargin / 2, // Less padding since there's nothing else on this page.
} satisfies Partial<Konva.GroupConfig>);
+ const overflowFooterText = new Konva.Text({
+ x: margin,
+ y: pageHeight - textXs - 10,
+ text: `${i18n._(msg`Envelope ID`)}: ${envelopeId}`,
+ fontFamily: 'Inter',
+ fontSize: textXs,
+ fill: textMutedForegroundLight,
+ });
+ page.add(overflowFooterText);
+
page.add(brandingGroup);
stage.add(page);