Home
Documentation
Resources
Partners
Community

Resources

Check for updates on our solutions and system performance, or request technical support.

Partners

Discover our program for agencies or developers that offer integration services and sellers who want to hire them.

Community

Get the latest news, ask others for help and share your knowledge.

Printing - Main Apps - Mercado Pago Developers

Intelligent search powered by OpenAI 

Printing

It is possible to use the thermal printer of the Point Smart devices to print bitmap images or custom images based on patterns called Custom Tags.

Note
If you want to print with an external printer, you will need to pair it with your device using Bluetooth functionality. Go to Print with an external printer for more information.

Print Bitmap

To print bitmap images with the Point Smart printer, use the print function of the BitmapPrinter class. Access is provided through the MPManager object, as shown in the example below:

          
val bitmapPrinter = MPManager.bitmapPrinter

val imageToPrint: Bitmap = bitmap // Get the bitmap image that will be printed

bitmapPrinter.print(imageToPrint) { response ->
   response.doIfSuccess { printResult ->
       // Handle success
   }.doIfError { error ->
       // Handle error in the printing operation

        
          
final BitmapPrinter bitmapPrinter = MPManager.INSTANCE.getBitmapPrinter();

final Bitmap imageToPrint = bitmap // Get the bitmap image that will be printed

final Function1<MPResponse<String>, Unit> callback = (final MPResponse<String> response) -> {
 if (response.getStatus() == ResponseStatus.SUCCESS) {
   // Handle success
 } else {
   // Handle error in the printing operation
 }
 return Unit.INSTANCE;
};

bitmapPrinter.print(imageToPrint, callback);

        
FieldDescription
dataToPrint (Bitmap)The bitmap image that will be printed.
callback ((MPResponse<String>) -> Unit)Request response feature that provides the result of the printing operation. The [MPResponse] includes the status, the error (if any), and the details in case of success, which contain a String representing the ID or status of the printing.

Print Custom Tag

The print function of the BitmapPrinter class in our SDK can also be used to create custom prints. This is done based on a pattern called a Custom Tag, which consists of sending a string with different control tags for subsequent interpretation by our system, resulting in a physical receipt.

Below is an example of how this functionality can be implemented:

          
val bitmapPrinter = MPManager.bitmapPrinter

val customTagToPrint: String = "{br}{b}this is a test text{/s}" 

val paymentMethodName: String? = null // Optional parameter that allows printing the name of the payment method used.

val printPdf417InReceipt: Boolean? = null // Optional parameter that allows printing the pdf417 barcode (the stain). Default value: null

bitmapPrinter.print(customTagToPrint, paymentMethodName, printPdf417InReceipt) { response ->
   response.doIfSuccess { printResult ->
       // Handle the successful print

   }.doIfError { error ->
       // Handle the error in the print operation

        
          
final BitmapPrinter bitmapPrinter = MPManager.INSTANCE.getBitmapPrinter();

final String customTagToPrint = "{br}{b}this is a test text{/s}"

@Nullable
final String paymentMethodName; // Optional parameter that allows printing the name of the payment method.

@Nullable
final Boolean printPdf417InReceipt; // Optional parameter that allows printing the pdf417 barcode (the stain).

final Function1<MPResponse<String>, Unit> callback = (final MPResponse<String> response) -> {
 if (response.getStatus() == ResponseStatus.SUCCESS) {
   // Handle the successful print
 } else {
   // Handle the error in the print operation

 }
 return Unit.INSTANCE;
};

bitmapPrinter.print(customTagToPrint, paymentMethodName, printPdf417InReceipt, callback);