mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 16:51:38 +10:00
fix: handle signature annotations
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
import signer from 'node-signpdf';
|
||||
import { PDFArray, PDFDocument, PDFHexString, PDFName, PDFNumber, PDFString } from 'pdf-lib';
|
||||
import {
|
||||
PDFArray,
|
||||
PDFDocument,
|
||||
PDFHexString,
|
||||
PDFName,
|
||||
PDFNumber,
|
||||
PDFString,
|
||||
rectangle,
|
||||
} from 'pdf-lib';
|
||||
|
||||
export type AddSigningPlaceholderOptions = {
|
||||
pdf: Buffer;
|
||||
@ -39,6 +47,12 @@ export const addSigningPlaceholder = async ({ pdf }: AddSigningPlaceholderOption
|
||||
P: pages[0].ref,
|
||||
});
|
||||
|
||||
const xobj = widget.context.formXObject([rectangle(0, 0, 0, 0)]);
|
||||
|
||||
const streamRef = widget.context.register(xobj);
|
||||
|
||||
widget.set(PDFName.of('AP'), widget.context.obj({ N: streamRef }));
|
||||
|
||||
const widgetRef = doc.context.register(widget);
|
||||
|
||||
let widgets = pages[0].node.get(PDFName.of('Annots'));
|
||||
|
||||
Reference in New Issue
Block a user