Class Signature

    • Method Detail

      • getBitmap

        @WorkerThread() final Bitmap getBitmap()

        Gets the bitmap used for rendering the image signature, or null if the signature is not an image signature.

        NOTE: The returned bitmap is kept in memory in a hash map but this method is meant to be used as an auxiliary method for adding the signature to the document. The bitmap may be destroyed when the app is in background and the system kills the process because needs to release memory resources. This method does not guarantee persistence, to implement this kind of use case it's better to rely on a database, or a cache mechanism that stores the bitmap in the local storage.

        Returns:

        Bitmap used for rendering the image signature, or null if the signature is not an image signature.

      • getBoundingBox

         final RectF getBoundingBox()

        Returns bounding box of the signature data in pdf coordinates. The bounding box will always have its left and bottom values equal 0.

        Returns:

        Rect enclosing all lines of this signature. Always starts at (0,0) (bottom left corner).

      • getId

         final Long getId()

        Signature id number used in signature database. If not set, the default value is ID_NOT_SET.

      • getSignatureDrawWidthRatio

         final Float getSignatureDrawWidthRatio()

        The ratio of signature width to width of the drawing view used when drawing the signature.

        This size is used in toAnnotation to auto-size annotation around touched point so that the largest signatures cover 1/4 of the page and smaller less.

      • getStampRect

         final RectF getStampRect()

        Bounding rectangle for this signature's bitmap.

      • toJson

         final JSONObject toJson()

        Converts a signature into a JSON object. You can use that JSON object to recreate the signature later on via fromJson.

        Returns:

        A JSON object representing a converted signature.

      • toInkAnnotation

         final InkAnnotation toInkAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, PointF touchPoint)

        Builds ink annotation from signature data.

        Parameters:
        document - Target document where the annotation will be added to.
        pageIndex - Target page index in document where the annotation will be added to.
        touchPoint - Point where the annotation should be created.
        Returns:

        Ink annotation representing this signature, or null if class is not an ink signature.

      • toInkAnnotation

         final InkAnnotation toInkAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, RectF targetRect)

        Builds ink annotation from signature data.

        Parameters:
        document - Target document where the annotation will be added to.
        pageIndex - Target page index in document where the annotation will be added to.
        targetRect - Rect on the page into which the annotation should be fitted.
        Returns:

        Ink annotation representing this signature, or null if class is not an ink signature.

      • toInkAnnotation

         final InkAnnotation toInkAnnotation(@IntRange(from = 0) Integer pageIndex)

        Builds ink annotation from signature data. This method does not set annotation's bounding box. If you want to create a stamp annotation with bounding box around certain touch point, use .toInkAnnotation instead.

        Parameters:
        pageIndex - Target page index where the annotation will be added to.
        Returns:

        Ink annotation representing this signature, or null if class is not an ink signature.

      • toStampAnnotation

         final StampAnnotation toStampAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, PointF touchPoint)

        Builds stamp annotation from signature data.

        Parameters:
        document - Target document where the annotation will be added to.
        pageIndex - Target page index in document where the annotation will be added to.
        touchPoint - Point where the annotation should be created.
        Returns:

        Stamp annotation representing this signature, or null if class is not an image signature.

      • toStampAnnotation

         final StampAnnotation toStampAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, RectF targetRect)

        Builds stamp annotation from signature data.

        Parameters:
        document - Target document where the annotation will be added to.
        pageIndex - Target page index in document where the annotation will be added to.
        targetRect - Rect on the page into which the annotation should be fitted.
        Returns:

        Stamp annotation representing this signature, or null if class is not an image signature.

      • toStampAnnotation

         final StampAnnotation toStampAnnotation(@IntRange(from = 0) Integer pageIndex)

        Builds stamp annotation from signature data. If you want to create a stamp annotation with a specific bounding box around certain touch point, use .toStampAnnotation instead.

        Parameters:
        pageIndex - Target page index where the annotation will be added to.
        Returns:

        Stamp annotation representing this signature, or null if class is not an image signature.