Add electronic signature images to PDFs using JavaScript
Use our API to add electronic signature images to PDFs.
import PSPDFKit from "@nutrient-sdk/viewer";
export function load(defaultConfiguration) { return PSPDFKit.load(defaultConfiguration).then(async (instance) => { console.log("Nutrient Web SDK successfully loaded!!", instance);
const annotations = await instance.getAnnotations(0);
if ( !annotations.find( (annotation) => annotation.customData && annotation.customData.progrmmatic ) ) { const blob = await fetch( "/programmatic-image-signature/static/jappleseed.png" ).then((res) => res.blob()); const imageAttachmentId = await instance.createAttachment(blob); const imageSignature = new PSPDFKit.Annotations.ImageAnnotation({ boundingBox: new PSPDFKit.Geometry.Rect({ width: 300, height: 166, top: 562, left: 140, }), imageAttachmentId, isSignature: true, pageIndex: 0, contentType: "image/png", description: "John Appleseed", customData: { progrmmatic: true, }, });
instance.create(imageSignature); }
return instance; });}
This code sample is an example that illustrates how to use our SDK. Please adapt it to your specific use case.