🚧 place signatures and text signatures

This commit is contained in:
Timur Ercan
2023-02-20 14:49:17 +01:00
parent 11eb557dbb
commit 44884ae648
10 changed files with 891 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
import { degrees, PDFDocument, rgb, StandardFonts } from "pdf-lib";
import { PDFDocument, rgb, StandardFonts } from "pdf-lib";
export async function insertTextInPDF(
pdfAsBase64: string,
@@ -13,10 +13,12 @@ export async function insertTextInPDF(
const helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica);
const pages = pdfDoc.getPages();
const firstPage = pages[page];
firstPage.drawText(text, {
x: positionX,
y: positionY,
const pdfPage = pages[page];
const lineHeightEsimate = 25;
pdfPage.drawText(text, {
x: pdfPage.getWidth() - positionX,
y: pdfPage.getHeight() - positionY - lineHeightEsimate,
size: 25,
font: helveticaFont,
color: rgb(0, 0, 0),