ActivityStarter and Printer POS

201 views
Skip to first unread message

Carlos Andre

unread,
May 27, 2019, 2:26:17 PM5/27/19
to MIT App Inventor Forum
I'm developing an app that will print tickets, but I'm not sure how to do this. I think it would be through the activitystarter. Attaching printer documentation with classes and packages. can you help me? Thank you.
doc_sdk.rar

ABG

unread,
May 27, 2019, 3:40:35 PM5/27/19
to MIT App Inventor Forum
Unless you are comfortable with Java and want to write an extension, this doc is useless ...
A data stream doc would be more helpful.

ABG
  • PREV CLASS
  • NEXT CLASS
  • SUMMARY: 
  • NESTED | 
  • FIELD | 
  • CONSTR | 
  • METHOD
  • DETAIL: 
  • FIELD | 
  • CONSTR | 
  • METHOD
br.com.gertec.gedi.interfaces

Interface IPRNTR

    • Method Summary

      All MethodsInstance MethodsAbstract Methods
      Modifier and TypeMethod and Description
      voidDrawBarCode(br.com.gertec.gedi.structs.GEDI_PRNTR_st_BarCodeConfig config, java.lang.String data)
      Draws a barcode to the print buffer.
      voidDrawBlankLine(int height)
      Draws a blank line to the print buffer.
      voidDrawPictureExt(br.com.gertec.gedi.structs.GEDI_PRNTR_st_PictureConfig config, android.graphics.Bitmap bitmap)
      Draws a picture on the printer buffer, using specified configuration.
      voidDrawStringExt(br.com.gertec.gedi.structs.GEDI_PRNTR_st_StringConfig config, java.lang.String text)
      Draws a text on the printer buffer.
      intGetPaperUsage()
      Retrieves the accumulated paper usage since the last paper usage reset.
      voidInit()
      Initializes the printer.
      voidOutput()
      Outputs the current printer buffer.
      voidResetPaperUsage()
      Sets the paper usage to 0 (zero).
      br.com.gertec.gedi.enums.GEDI_PRNTR_e_StatusStatus()
      Checks the Printer status.
    • Method Detail

      • Init

        void Init()
           throws br.com.gertec.gedi.exceptions.GediException
        Initializes the printer. Clear the contents of the printer buffer.
        The printer buffer is where the printer drawing functions will take place.
        This function will also clear anything previously drawn on the printer buffer.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • DrawStringExt

        void DrawStringExt(br.com.gertec.gedi.structs.GEDI_PRNTR_st_StringConfig config,
                           java.lang.String text)
                    throws br.com.gertec.gedi.exceptions.GediException
        Draws a text on the printer buffer.
        Parameters:
        config - Config object to customize the text to print (size, style, spacing, etc.).
                 Ex.:
                    GEDI_PRNTR_st_StringConfig config = new GEDI_PRNTR_st_StringConfig(new Paint());
                    config.paint.setTextSize(30);
                    config.paint.setTextAlign(Paint.Align.LEFT);
                    config.paint.setTypeface(Typeface.DEFAULT_BOLD);
                    config.lineSpace = 10;
                 
        text - String to draw.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • DrawPictureExt

        void DrawPictureExt(br.com.gertec.gedi.structs.GEDI_PRNTR_st_PictureConfig config,
                            android.graphics.Bitmap bitmap)
                     throws br.com.gertec.gedi.exceptions.GediException
        Draws a picture on the printer buffer, using specified configuration.
        Parameters:
        config - Config object to customize the bitmap to print. Use default values if null.
        bitmap - Bitmap of the picture to print.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • DrawBlankLine

        void DrawBlankLine(int height)
                    throws br.com.gertec.gedi.exceptions.GediException
        Draws a blank line to the print buffer.
        It is usually called to feed the paper after printing all contents.
        Parameters:
        height - Blank line height.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • DrawBarCode

        void DrawBarCode(br.com.gertec.gedi.structs.GEDI_PRNTR_st_BarCodeConfig config,
                         java.lang.String data)
                  throws br.com.gertec.gedi.exceptions.GediException
        Draws a barcode to the print buffer.
        Parameters:
        config - Config object to customize the barcode to print. Depending on the barcode type, some values are ignored.
        The type PDF_417 only consider the width value, ignoring the height value.
        data - Content to print as barcode.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • Output

        void Output()
             throws br.com.gertec.gedi.exceptions.GediException
        Outputs the current printer buffer.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • Status

        br.com.gertec.gedi.enums.GEDI_PRNTR_e_Status Status()
                                                     throws br.com.gertec.gedi.exceptions.GediException
        Checks the Printer status.
        Returns:
        a bit mask containing the status of the printer.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • GetPaperUsage

        int GetPaperUsage()
                   throws br.com.gertec.gedi.exceptions.GediException
        Retrieves the accumulated paper usage since the last paper usage reset. G800 no available.
        Returns:
        the paper usage.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
      • ResetPaperUsage

        void ResetPaperUsage()
                      throws br.com.gertec.gedi.exceptions.GediException
        Sets the paper usage to 0 (zero). G800 no available.
        Throws:
        br.com.gertec.gedi.exceptions.GediException - See the documentation for more information.
  • PREV CLASS
  • NEXT CLASS
  • SUMMARY: 
  • NESTED | 
  • FIELD | 
  • CONSTR | 
  • METHOD
  • DETAIL: 
  • FIELD | 
  • CONSTR | 
  • METHOD

Carlos Andre

unread,
May 28, 2019, 7:38:49 AM5/28/19
to MIT App Inventor Forum

ABG

unread,
May 28, 2019, 9:29:45 AM5/28/19
to MIT App Inventor Forum
Buried deep in your zip file there is a built sample .apk file at
\20190123_SDK_TSG800 (4).zip\20190123_SDK_TSG800\TSG800 - Impressora\ESCPOS\PrintESCPOS_TSG800\app\build\intermediates\instant-run-apk\debug\
that you should be able to extract using 7zip.

What happens if you load that to your phone/device and run it?

How were you planning on connecting your phone/device to the printer?
(BlueTooth? / WiFi?  / USB Cable?)

ABG

Capture.PNG

ABG

unread,
May 28, 2019, 9:35:48 AM5/28/19
to MIT App Inventor Forum
There is a more likely .apk file higher up in your .zip file.

What do you get if you run it?

(See attached)

ABG

Capture.PNG

Carlos Andre

unread,
May 29, 2019, 7:30:02 AM5/29/19
to MIT App Inventor Forum


I performed. Is a sample application with printer features (center text, left text, bold ...)

ABG

unread,
May 29, 2019, 11:16:02 AM5/29/19
to MIT App Inventor Forum
Did the sample app see your printer?

ABG

Reply all
Reply to author
Forward
0 new messages