Official Content

The Printer external object enables you to print files (with PDF, PNG, JPG, and TXT extensions) from an Android application directly to a Bluetooth printer connected to the device.

PrinterEO_15022023

You can find the Printer object in the KB Explorer within the SD module, which is in turn located within the GeneXus module. That is to say, it is part of the Smart Devices API.

Properties

PrinterName

Sets the name of the printer to be used for printing. The name must match the Bluetooth name of the device.

Dpi

Sets the resolution of the printer. Check the manufacturer's manual. The default value is 203 dpi.

Width

Sets the printable width. The default value is 48 mm. For the Leopardo A7 printer, the value is 208 mm.

Methods

GetDevices method

Returns a list with the names of the devices previously connected. It doesn't distinguish printers.

Return value  VarChar
Parameters None.

Print method

Uses the current printer to print the specified file.

Supported file extensions are PDF, PNG, JPG, and TXT. 

PDFs and images are scaled down if they are too wide based on the settings, but they aren't scaled up.

It automatically connects if necessary and it disconnects if 15 minutes of inactivity have passed.

Return value  None.
Parameters Path:VarChar, [Rotation:Rotation].

Rotation is a numeric value that indicates the rotation of the report. The possible values are as follows:

  • 0: Prints normally. Default value. 
  • 1: Rotates left before printing.
  • 2: Rotates right before printing.

CutPaper method

For printers that support this method, it cuts the paper.

Return value  None.
Parameters None.

Events

It doesn't have any.  

Considerations

  • Only Procedure objects that have PDF output are supported. That is to say, they must contain the Output_File(!'<FileName>', !'PDF') rule. In addition, their Connectivity Support property value must be "Offline".
  • The code that uses the external object must be included inside a client-side event (even if the Panel object has its Connectivity Support property = "Online"). The Panel object must have its Use PDF Reports property set to True.

Troubleshooting

  • In some printers, if an incorrect value is entered in the Width property, the printout may contain unreadable characters.
  • When printing PDF reports, the pages of the report are printed. Therefore, if the last page has a lot of extra white space, this will be reflected in the printout. The page size is determined by the Paper Height property of the Layout.

Scope

Generators: AndroidApple

   

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant