Creating a signature field in a PDF using JavaScript

Skip to first unread message

Julio Cesar Llavilla Ccama

Apr 6, 2021, 11:45:25 AM4/6/21
to PDFTron WebViewer
I want to create a field in which a signature can be inserted something like what is indicated in the documentation:
      path: 'lib/',
      fullAPI: true,
      initialDoc: 'example0006.pdf',
      //config: 'config.js',
    }, document.getElementById('viewer')).then(async instance => {
      const { Annotations, annotManager, PDFNet, CoreControls, signatureWidgetAnnots, docViewer  } = instance;

      const createSignHereElement = Annotations.SignatureWidgetAnnotation.prototype.createSignHereElement;
      Annotations.SignatureWidgetAnnotation.prototype.createSignHereElement = function() {
        const signHereElement = createSignHereElement.apply(this, arguments); = 'red';
        return signHereElement;


I have tried everything and it has not worked for me, please if anyone knows how it works I will appreciate it very much.



Apr 6, 2021, 3:47:02 PM4/6/21
to PDFTron WebViewer
Hi there, 

Thanks for reaching out!

If you would like to add a signature field to a PDF directly in the web browser, you can take a look at this sample:
The sample code is available in the `WebViewer/samples/forms/form-builder` if you download the WebViewer folder and also available online:

Best Regards, 
Jimmy Lin
Software Developer
PDFTron Systems, Inc.

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.
Reply all
Reply to author
0 new messages