Frequently Asked Question

How to add an Ink signature to a pdf.
Last Updated 11 months ago

This article shows how to add an Ink signature over a signature annot.

You need a premium license to do this.

First of all you have to check the annot type and then launch your activity/view that handles signature capture using Ink features:

if(m_annot != null && m_annot.GetFieldType() == 4){
   //save annot position, here will be placed the annot with the sign
   yourPosition = m_annot.GetRect();
   //handle annot
   startActivityForResult(new Intent(PDFReaderAct.this, CaptureSignatureActivity.class), SIGNATURE_ACTIVITY);
}

You have to save the signature into a Bitmap (yourSignatureBitmap)

Then, when you have captured and saved the signature, add it to the pdf :

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == SIGNATURE_ACTIVITY) {
      if (resultCode == RESULT_OK) {
         if (data.getStringExtra("status").equalsIgnoreCase("done")) {
            Page currentPage = m_doc.GetPage(yourSignPage);

            String file_cache = Global.tmp_path + "/temp.dat";
            m_doc.SetCache(file_cache); //set temporary cache for editing.

            //add annot
            if (currentPage.AddAnnotBitmap(yourSignatureBitmap, true, yourPosition))
               //lock the annot (if necessary)
               currentPage.GetAnnot(currentPage.GetAnnotCount() - 1).SetLocked(true);
            
            // scale + refresh pagina
            m_vPDF.PDFSetScale(0);
            m_vPDF.PDFSave();
         }
      }
   }
}


Loading ...