nxt.http

## Class EncodeQRCode

- java.lang.Object
- - nxt.http.APIServlet.APIRequestHandler
  - - nxt.http.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.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `allowRequiredBlockParameters()`
    `protected org.json.simple.JSONStreamAware` | `processRequest(javax.servlet.http.HttpServletRequest request)`
    `protected boolean` | `requireBlockchain()`
    `protected boolean` | `requirePost()`

    - ### Methods inherited from class nxt.http.APIServlet.APIRequestHandler

      `getAPITags, getFileParameter, getParameters, isPassword, isTextArea, processRequest, requireFullClient, requirePassword, startDbTransaction`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### processRequest

          protected org.json.simple.JSONStreamAware processRequest(javax.servlet.http.HttpServletRequest request)
                                                            throws NxtException

      Specified by:
        `processRequest` in class `APIServlet.APIRequestHandler`
      Throws:
        `NxtException`

    - #### requirePost

          protected final boolean requirePost()

      Overrides:
        `requirePost` in class `APIServlet.APIRequestHandler`

    - #### allowRequiredBlockParameters

          protected boolean allowRequiredBlockParameters()

      Overrides:
        `allowRequiredBlockParameters` in class `APIServlet.APIRequestHandler`

    - #### requireBlockchain

          protected boolean requireBlockchain()

      Overrides:
        `requireBlockchain` in class `APIServlet.APIRequestHandler`