Class MPTPrinter


  • public class MPTPrinter
    extends BluetoothPrinter
    This class extends BluetoothPrinter to send special MTP commands to the printer. Reference: http://www.rego.ro/down/REGO-MPT-TM.pdf
    • Constructor Detail

      • MPTPrinter

        public MPTPrinter()
                   throws IOException
        Creates a new CitizenPrinter instance, using PortConnector.BLUETOOTH port at 57600 baud rate.
        Throws:
        IOException
      • MPTPrinter

        public MPTPrinter​(PortConnector con)
                   throws IOException
        Creates a new CitizenPrinter instance, using the given PortConnector as bridge to the printer. Note that PortConnector can use any port (including infrared), however, it is not guaranteed that it will work with that port. For example, IR does not work on Palm OS devices.
        Throws:
        IOException
      • MPTPrinter

        public MPTPrinter​(Stream con)
                   throws IOException
        Creates a new CitizenPrinter instance, using the given Stream as bridge to the printer.
        Throws:
        IOException
    • Method Detail

      • reset

        public void reset()
                   throws IOException
        Resets the printer, canceling previous font and line spacing
        Throws:
        IOException
      • setFont

        public void setFont​(boolean bold,
                            boolean doubleWidth,
                            boolean doubleHeight,
                            boolean underline)
                     throws IOException
        Sets the current font based on the given attributes.
        Throws:
        IOException
      • setCharSize

        public void setCharSize​(boolean doubleW,
                                boolean doubleH)
                         throws IOException
        Sets the character size
        Throws:
        IOException
      • setSpaceWidth

        public void setSpaceWidth​(int w)
                           throws IOException
        Sets the space character width, between 0 and 32.
        Throws:
        IOException
      • setXPos

        public void setXPos​(int x)
                     throws IOException
        Sets the absolute position to start printing.
        Throws:
        IOException
      • singleLineHeight

        public void singleLineHeight()
                              throws IOException
        Single-space line height.
        Throws:
        IOException
      • setLineHeight

        public void setLineHeight​(int n)
                           throws IOException
        User-defined line height (n / 203 inches height).
        Throws:
        IOException
      • setRotation90

        public void setRotation90​(boolean on)
                           throws IOException
        Enables 90-degree rotation.
        Throws:
        IOException
      • setRotation1800

        public void setRotation1800​(boolean on)
                             throws IOException
        Enables 180-degree rotation.
        Throws:
        IOException
      • setDensity

        public void setDensity​(int n)
                        throws IOException
        Sets the font density, between 0 and 5.
        Throws:
        IOException
      • setHorizontalAlignment

        public void setHorizontalAlignment​(int v)
                                    throws IOException
        Sets the horizontal text alignment. Use Control.LEFT, Control.CENTER, Control.RIGHT.
        Throws:
        IOException