How to add electronic signatures to PDFs on Android
This guide explains how to add an electronic signature (eSignature) to a PDF document on Android using Nutrient Android SDK, both through the built-in user interface (UI) and programmatically.
Adding an electronic signature programmatically
In Nutrient Android SDK, electronic signatures are implemented as PDF annotations, commonly referred to as signature annotations.
Electronic signatures can be either ink or image annotations, created with:
InkAnnotationfor drawn signatures.StampAnnotationfor image-based signatures.
To apply an eSignature:
- Use
setIsSignature(true)to mark the annotation as a signature. - Add it to the document via
PdfFragment#addAnnotationToPage().
Licensing requirements for signature annotations
Creating, updating, and deleting signature annotations requires a license that includes either the Annotations component or the Electronic Signatures component. If your license includes only the Electronic Signatures component (without the Annotations component), modifications are restricted to signature annotations exclusively. Any attempt to modify non-signature ink or image annotations (isSignature = false) or other annotation types will be disallowed.
Creating an ink signature
To create an ink signature programmatically, use to the following code snippet:
val pdfFragment: PdfFragment = ...
// Create the ink annotation.val annotation = InkAnnotation(0)
// Set the line color and width.annotation.color = Color.REDannotation.lineWidth = 3f
// Set the stroke data. For example, this would be loaded from end user input on another device.// This example code is just hardcoding a stroke with three points.val line = listOf( PointF(100f, 100f), PointF(150f, 150f), PointF(200f, 100f))annotation.lines = listOf(line)
// Mark this ink annotation as a signature.annotation.setIsSignature(true)
// Add it to the page.pdfFragment?.addAnnotationToPage(annotation, false)final PdfFragment pdfFragment = ...
// Create the ink annotation.final InkAnnotation annotation = new InkAnnotation(0);
// Set the line color and width.annotation.setColor(Color.RED);annotation.setLineWidth(3f);
// Set the stroke data. For example, this would be loaded from end user input on another device.// This example code is just hardcoding a stroke with three points.final List<PointF> line = Arrays.asList( new PointF(100, 100), new PointF(150, 150), new PointF(200, 100));annotation.setLines(Collections.singletonList(line));
// Mark this ink annotation as a signature.annotation.setIsSignature(true);
// Add it to the page.getPdfFragment().addAnnotationToPage(annotation, false);Creating an image signature
To create an image signature programmatically, use to the following code snippet:
val pdfFragment: PdfFragment = ...val bitmap = BitmapFactory.decodeFile("my-signature.png")
// Create the image annotation.val annotation = StampAnnotation(0, RectF(50f, 440.0f, 500f, 0.0f), bitmap)
// Mark this image annotation as a signature.annotation.setIsSignature(true)
// Add it to the page.pdfFragment?.addAnnotationToPage(annotation, false)final PdfFragment pdfFragment = ...final Bitmap bitmap = BitmapFactory.decodeFile("my-signature.png");
// Create the image annotation.final StampAnnotation annotation = new StampAnnotation(0, new RectF(100, 100, 300, 140), bitmap);
// Mark this image annotation as a signature.annotation.setIsSignature(true);
// Add it to the page.getPdfFragment().addAnnotationToPage(annotation, false);Using the built-in UI
If you’re using the SDK with Forms, end users can initiate the signature creation modal by tapping a signature form field within the document. If no signature form field is present, end users can manually add a signature using the signature tool button.

If the Annotations component is included in your license, the signature tool is available within the annotation toolbar.
If the Annotations component isn’t included, the signature tool appears directly in the main toolbar by default. If your license includes the Annotations component too, you can show it in the main toolbar. Append a ToolbarItem.Button with the ID PdfActivity.MENU_OPTION_SIGNATURE to the default items in setToolbarItemsProvider:
override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState)
setToolbarItemsProvider { defaultItems -> defaultItems + ToolbarItem.Button( actionId = resources.getResourceEntryName(PdfActivity.MENU_OPTION_SIGNATURE), id = PdfActivity.MENU_OPTION_SIGNATURE, contentDescription = getString(com.pspdfkit.R.string.pspdf__signature), icon = ToolbarIcon.Resource(com.pspdfkit.R.drawable.pspdf__ic_signature), ) }}@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setToolbarItemsProvider(defaultItems -> { final List<ToolbarItem> items = new ArrayList<>(defaultItems); items.add(new ToolbarItem.Button( getResources().getResourceEntryName(PdfActivity.MENU_OPTION_SIGNATURE), PdfActivity.MENU_OPTION_SIGNATURE, getString(com.pspdfkit.R.string.pspdf__signature), new ToolbarIcon.Resource(com.pspdfkit.R.drawable.pspdf__ic_signature), new ToolbarItemState(true, false, true), ToolbarItem.ItemEdge.End, ToolbarItem.OverflowBehavior.IfRoom)); return items; });}The forceSignatureButtonPositionInMainToolbar() option of PdfActivityConfiguration.Builder is deprecated as of Nutrient Android SDK 12.1.

Signature creation modal view
When the signature creation modal view is displayed, end users can add a signature using one of three methods:
- Draw — End users can create a handwritten signature using a touchscreen or stylus.
- Attach an image — End users can attach an existing signature image from their device.
- Type — End users can enter their signature as text using a chosen font style.
End users can attach an existing signature image from their device. If the hardware supports it, they can also capture a photo of their handwritten signature on paper for a digital scan. This option is ideal when signing on a device with easy access to stored files.
End users can enter their name and select from a predefined set of font-based signature styles. This method ensures accessibility and is fully compatible with:
- Screen readers such as VoiceOver, TalkBack, NVDA, and JAWS.
- Assistive technologies such as Switch Control on Mac and iOS.
By default, Nutrient provides four signature styles, and you can customize the available options by defining a list of preferred fonts.
Color options
For both the Draw and Type options, end users can choose between black, purple, and blue by default. These colors keep the signature distinguishable from the document background.
Stroke thickness and opacity
You can set the stroke thickness and opacity of signatures created in the signature creation modal view. Alternatively, let end users pick them in a UI of your own before the modal view opens. For more information, refer to the signature UI customization guide.