feat: add name field

Adds support for a name field which will be prefilled with the recipients name if they haven't signed a form on Documenso before.
This commit is contained in:
Mythie
2023-04-19 22:48:26 +10:00
parent 5c58b32d92
commit b444d5c928
8 changed files with 151 additions and 14 deletions

View File

@ -8,7 +8,8 @@ export async function insertTextInPDF(
positionX: number,
positionY: number,
page: number = 0,
useHandwritingFont = true
useHandwritingFont = true,
fontSize = 15
): Promise<string> {
const fontBytes = fs.readFileSync("public/fonts/Qwigley-Regular.ttf");
@ -21,7 +22,7 @@ export async function insertTextInPDF(
const pages = pdfDoc.getPages();
const pdfPage = pages[page];
const textSize = useHandwritingFont ? 50 : 15;
const textSize = useHandwritingFont ? 50 : fontSize;
const textWidth = font.widthOfTextAtSize(text, textSize);
const textHeight = font.heightAtSize(textSize);
const fieldSize = { width: 192, height: 64 };