Class BarCode


  • public class BarCode
    extends Code
    This class represents a barcode or a QR code (created using the data of the key) for a template.
    • Constructor Summary

      Constructors 
      Constructor Description
      BarCode​(java.lang.String name, java.lang.String type, java.lang.String value)
      This class represents a barcode (created using the data of the key) for a template.
    • Constructor Detail

      • BarCode

        public BarCode​(java.lang.String name,
                       java.lang.String type,
                       java.lang.String value)
        This class represents a barcode (created using the data of the key) for a template. All the options can be set with the setter functions.
        Parameters:
        name - Name of this code for the tag.
        type - Type of barcode required. The options can be found on: http://www.cloudofficeprint.com/docs/#barcode-qrcode-tags
        value - Data to create the code from.
    • Method Detail

      • getHeight

        public java.lang.Integer getHeight()
        Returns:
        Height for the generated code.
      • setHeight

        public void setHeight​(java.lang.Integer height)
        Parameters:
        height - Height for the generated code. Default is 200 for QR, 50 for the rest.
      • getWidth

        public java.lang.Integer getWidth()
        Returns:
        Width for the generated code.
      • setWidth

        public void setWidth​(java.lang.Integer width)
        Parameters:
        width - Width for the generated code. Default is 200.
      • getLinkUrl

        public java.lang.String getLinkUrl()
        Returns:
        URL to hyperlink to when the code is clicked.
      • setLinkUrl

        public void setLinkUrl​(java.lang.String linkUrl)
        Parameters:
        linkUrl - URL to hyperlink to when the code is clicked.
      • getRotation

        public java.lang.Integer getRotation()
        Returns:
        Angle on which the inserted code should be rotated (in degrees, counterclockwise).
      • setRotation

        public void setRotation​(java.lang.Integer rotation)
        Parameters:
        rotation - Angle on which the inserted code should be rotated (in degrees, counterclockwise).
      • getBackgroundColor

        public java.lang.String getBackgroundColor()
        Returns:
        The background color for the code.
      • setBackgroundColor

        public void setBackgroundColor​(java.lang.String backgroundColor)
        Parameters:
        backgroundColor - The background color for the code. Default: white/ffffff.
      • getPaddingWidth

        public java.lang.Integer getPaddingWidth()
        Returns:
        The padding width on the inserted code in pixels.
      • setPaddingWidth

        public void setPaddingWidth​(java.lang.Integer paddingWidth)
        Parameters:
        paddingWidth - The padding width on the inserted code in pixels. Default 10 px.
      • getPaddingHeight

        public java.lang.Integer getPaddingHeight()
        Returns:
        The padding height on the inserted code in pixels.
      • setPaddingHeight

        public void setPaddingHeight​(java.lang.Integer paddingHeight)
        Parameters:
        paddingHeight - The padding height on the inserted code in pixels. Default 10 px.
      • getQrErrorCorrectionLevel

        public java.lang.String getQrErrorCorrectionLevel()
        Only for QR codes.
        Returns:
        Level at which the QR code should be recoverable. The options are: "L" (up to 7% damage) "M" (up to 15% damage) "Q" (up to 25% damage) "H" (up to 30% damage)
      • setQrErrorCorrectionLevel

        public void setQrErrorCorrectionLevel​(java.lang.String qrErrorCorrectionLevel)
        Only for QR codes.
        Parameters:
        qrErrorCorrectionLevel - Level at which the QR code should be recoverable. The options are: "L" (up to 7% damage) "M" (up to 15% damage) "Q" (up to 25% damage) "H" (up to 30% damage)
      • getExtraOptions

        public java.lang.String getExtraOptions()
        If you want to include extra options like including barcode text on the botto The options should be space separated and should be followed by a "=" and their value. E.g.: "includetext guardwhitespace guardwidth=3 guardheight=3". Please visit: https://github.com/bwipp/postscriptbarcode/wiki/Symbologies-Reference for all option availability.
        Returns:
        These extra options.
      • setExtraOptions

        public void setExtraOptions​(java.lang.String extraOptions)
        If you want to include extra options like including barcode text on the botto The options should be space separated and should be followed by a "=" and their value. E.g.: "includetext guardwhitespace guardwidth=3 guardheight=3". Please visit: https://github.com/bwipp/postscriptbarcode/wiki/Symbologies-Reference for all option availability.
        Parameters:
        extraOptions - These extra options.
      • getJSON

        public com.google.gson.JsonObject getJSON()
        Specified by:
        getJSON in class RenderElement
        Returns:
        JSONObject with the tags for this element for the Cloud Office Print server.