Class BillFormat

java.lang.Object
net.codecrete.qrbill.generator.BillFormat
All Implemented Interfaces:
Serializable

public class BillFormat extends Object implements Serializable
Formatting properties for QR bill
See Also:
  • Field Details

    • DEFAULT_MARGIN_WIDTH

      public static final double DEFAULT_MARGIN_WIDTH
      Default width for left and right margin, in mm.
      See Also:
  • Constructor Details

    • BillFormat

      public BillFormat()
      Creates a new instance with default values
    • BillFormat

      public BillFormat(BillFormat format)
      Copy constructor: creates a copy of the specified format
      Parameters:
      format - format to copy
  • Method Details

    • getOutputSize

      public OutputSize getOutputSize()
      Gets the output size for the generated QR bill

      Defaults to OutputSize.QR_BILL_ONLY, i.e. the QR bill only (about 105 by 210 mm)

      Returns:
      output size
      See Also:
    • setOutputSize

      public void setOutputSize(OutputSize outputSize)
      Sets the output size for the generated QR bill
      Parameters:
      outputSize - output size
      See Also:
    • getLanguage

      public Language getLanguage()
      Gets the bill language.

      Defaults to EN (English).

      Returns:
      the language
    • setLanguage

      public void setLanguage(Language language)
      Sets the bill language
      Parameters:
      language - the language
    • getSeparatorType

      public SeparatorType getSeparatorType()
      Gets the type of separator drawn above and between the payment part and the receipt

      Defaults to SeparatorType.DASHED_LINE_WITH_SCISSORS

      Returns:
      separator type
    • setSeparatorType

      public void setSeparatorType(SeparatorType separatorType)
      Sets the type of separator drawn above and between the payment part and the receipt
      Parameters:
      separatorType - separator type
    • getFontFamily

      public String getFontFamily()
      Gets the font family to be used for text

      According to the implementation guidelines Arial, Frutiger, Helvetica and Liberation Sans are the only permitted fonts.

      Two styles of the font are used: normal/regular and bold.

      Defaults to "Helvetica".

      Returns:
      font family name
    • setFontFamily

      public void setFontFamily(String fontFamily)
      Sets the font family to be used for text

      According to the implementation guidelines Arial, Frutiger, Helvetica and Liberation Sans are the only permitted fonts. However, any string is accepted as the font name might be more elaborate such as "Frutiger 55 Regular".

      Two styles of the font are used: normal/regular and bold.

      Defaults to "Helvetica".

      Parameters:
      fontFamily - font family name
    • getGraphicsFormat

      public GraphicsFormat getGraphicsFormat()
      Gets the graphics format for the generated QR bill

      Defaults to SVG.

      Returns:
      graphics format
    • setGraphicsFormat

      public void setGraphicsFormat(GraphicsFormat graphicsFormat)
      Sets the graphics format for the generated QR bill
      Parameters:
      graphicsFormat - graphics format
    • getResolution

      public int getResolution()
      Gets the resolution for pixel graphics formats.

      Defaults to 144 dpi.

      Returns:
      graphics resolution, in dpi
    • setResolution

      public void setResolution(int resolution)
      Sets the resolution for pixel graphics formats.
      Parameters:
      resolution - graphics resolution, in dpi
    • getMarginLeft

      public double getMarginLeft()
      Gets the left margin width (from edge of paper to start of text).

      Valid values are between 5mm and 12mm. The default is 5mm.

      Values other than 5mm are not fully standard compliant as the fields in the receipt on the left-hand side become narrower. It is especially obvious if Payable by or Amount are not pre-filled so that the black corners are printed instead of text. Yet values higher than 5mm are more compatible with typical office and home printers, which are not capable of printing up to the edge of the paper and require a margin wider than 5mm.

      Returns:
      margin width, in mm
    • setMarginLeft

      public void setMarginLeft(double marginLeft)
      Sets the left margin width (from edge of paper to start of text).

      Valid values are between 5mm and 12mm. The default is 5mm.

      Values other than 5mm are not fully standard compliant as the fields in the receipt on the left-hand side become narrower. It is especially obvious if Payable by or Amount are not pre-filled so that the black corners are printed instead of text. Yet values higher than 5mm are more compatible with typical office and home printers, which are not capable of printing up to the edge of the paper and require a margin wider than 5mm.

      Parameters:
      marginLeft - margin width, in mm
    • getMarginRight

      public double getMarginRight()
      Gets the right margin width (from the end of the text to the edge of the paper).

      Valid values are between 5mm and 12mm. The default is 5m.

      Values other than 5mm are not fully standard compliant but are more compatible with typical office and home printers, which are not capable of printing up to the edge of the paper and require a margin wider than 5mm.

      Returns:
      width, in mm
    • setMarginRight

      public void setMarginRight(double marginRight)
      Gets the right margin width (from the end of the text to the edge of the paper).

      Valid values are between 5mm and 12mm. The default is 5m.

      Values other than 5mm are not fully standard compliant but are more compatible with typical office and home printers, which are not capable of printing up to the edge of the paper and require a margin wider than 5mm.

      Parameters:
      marginRight - margin width, in mm
    • getLocalCountryCode

      public String getLocalCountryCode()
      Gets the local country code.

      For postal addresses of this country, the country code is omitted. For all other countries, the country is prepended to the postal code and town.

      Defaults to "CH".

      Returns:
      country code (ISO 3166, two uppercase letters).
    • setLocalCountryCode

      public void setLocalCountryCode(String localCountryCode)
      Sets the local country code.

      For postal addresses of this country, the country code is omitted. For all other countries, the country is prepended to the postal code and town.

      Defaults to "CH".

      Parameters:
      localCountryCode - country code (ISO 3166, two uppercase letters).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object