Package nxt.http

Class EncodeQRCode


  • public final class EncodeQRCode
    extends APIServlet.APIRequestHandler

    The EncodeQRCode API converts a UTF-8 string to a base64-encoded jpeg image of a 2-D QR (Quick Response) code, using the ZXing library.

    The output qrCodeBase64 string can be incorporated into an in-line HTML image like this: <img src="data:image/jpeg;base64,qrCodeBase64">

    The output qrCodeBase64 can be input to the DecodeQRCode API to recover the original qrCodeData.

    Request parameters:

    • qrCodeData - A UTF-8 text string.
    • width - The width of the output image in pixels, optional.
    • height - The height of the output image in pixels, optional.

    Notes:

    • The output image consists of a centrally positioned square QR code with a size which is an integer multiple of the minimum size, surrounded by sufficient white padding to achieve the requested width/height.
    • The default width/height of 0 results in the minimum sized output image, with one pixel per black/white region of the QR code and no extra padding.
    • To eliminate padding, the requested width/height must be an integer multiple of the minimum.

    Response fields:

    • qrCodeBase64 - A base64 string encoding a jpeg image of the QR code.