# MD for: https://www.mercadopago.com.ar/developers/en/docs/smartapps/terminal-features/configure-printings.md \# Configure printings With the printing feature, you can manage prints directly from your application and obtain them from the assigned terminal or send the print to a Bluetooth printer. > NOTE > > If you want to use a Bluetooth printer, it must be paired with the Point terminal. See \[Configure Bluetooth\](https://www.mercadopago.com.ar/developers/en/docs/smartapps/terminal-features/configure-bluetooth) for more information. With this feature, you can print purchase tickets and integrate custom prints. This functionality is useful for businesses that need to print complementary receipts, such as coupons or images. -------|-------------| | Taxed Invoice (33) and Exempt (34) | Refers to the tax document that has legal validity before the Internal Revenue Service (SII). | | Taxed Receipt (39) and Exempt (41) | Refers to the document that the customer receives when making a purchase, which has accounting and tax validity. | See below an example of how to print DTE (Electronic Tax Documents). * [java ](#editor%5F2) * [kotlin ](#editor%5F1) kotlin java ``` val bitmapPrinter = MPManager.bitmapPrinter /* If you need to print a DTE, replace the custom tag string with the xml */ val customTagToPrint: String = "{br}{b}Hello world{/b}{br}{br}{br}{s}this is a test text{/s}" /* Optional parameter that allows printing the name of the payment method used if you want to print an electronic receipt (DTE type 39,41). Default value: null */ val paymentMethodName: String? = null /* Optional parameter that allows printing the pdf417 barcode (the stain) if you want to print an electronic receipt (DTE type 39,41). Default value: null */ val printPdf417InBoleta: Boolean? = null bitmapPrinter.print(customTagToPrint, paymentMethodName, printPdf417InBoleta) { response -> response.doIfSuccess { printResult -> // Handle successful printing }.doIfError { error -> // Handle printing operation error } } ``` Copiar ``` final BitmapPrinter bitmapPrinter = MPManager.INSTANCE.getBitmapPrinter(); /* If you need to print a DTE, replace the custom tag string with the xml */ final String customTagToPrint = "{br}{b}Hello world{/b}{br}{br}{br}{s}this is a test text{/s}" /* Optional parameter that allows printing the name of the payment method used if you want to print an electronic receipt (DTE type 39,41). */ @Nullable final String paymentMethodName /* Optional parameter that allows printing the pdf417 barcode (the stain) if you want to print an electronic receipt (DTE type 39,41). */ @Nullable final Boolean printPdf417InBoleta final Function1, Unit> callback = (final MPResponse response) -> { if (response.getStatus() == ResponseStatus.SUCCESS) { // Handle successful printing } else { // Handle printing operation error } return Unit.INSTANCE; }; bitmapPrinter.print(customTagToPrint, paymentMethodName, printPdf417InBoleta, callback); ``` Copiar ::: :::: ::::: ------------ :::::AccordionComponent{title="Printing on Point terminal"} It is possible to use the thermal printer of Point Smart devices to print bitmap images or custom images from patterns called Custom Tags. ::::TabsComponent :::TabComponent{title="Image printing"} To print bitmap images with the Point terminal printer, use the \`print\` function from the \`BitmapPrinter\` class of the \`MPManager\` object. In the \`imageToPrint\` field, specify an image in PNG or JPEG format, with Base64 encoding and a maximum size of 1MB. See below an example of how to print an image. * [java ](#editor%5F4) * [kotlin ](#editor%5F3) kotlin java ``` val bitmapPrinter = MPManager.bitmapPrinter val imageToPrint: Bitmap = bitmap // Get the Bitmap image that will be printed bitmapPrinter.print(imageToPrint) { response -> response.doIfSuccess { printResult -> // Handle successful printing }.doIfError { error -> // Handle printing operation error } } ``` Copiar ``` final BitmapPrinter bitmapPrinter = MPManager.INSTANCE.getBitmapPrinter(); final Bitmap imageToPrint = bitmap // Get the Bitmap image that will be printed final Function1, Unit> callback = (final MPResponse response) -> { if (response.getStatus() == ResponseStatus.SUCCESS) { // Handle successful printing } else { // Handle printing operation error } return Unit.INSTANCE; }; bitmapPrinter.print(imageToPrint, callback); ``` Copiar ::: :::TabComponent{title="Custom printing"} The \`print\` function from the \`BitmapPrinter\` class of the \`MPManager\` object can also be used to create custom text printings. This is accomplished through a pattern called Custom Tag, which consists of sending a \_string\_ with different control tags for subsequent interpretation by the Mercado Pago system, resulting in a physical receipt. These \_tags\_ allow you to adjust the format and appearance of printed documents, ensuring greater control over text style and structure. To perform custom printings with the Point terminal printer, you must include in the \`customTagToPrint\` field a \_string\_ with the desired content, formatted using at least one of the supported \_tags\_. The content for this attribute has a minimum of 100 characters and a maximum of 4096, including the \_tags\_ themselves. Below, see the different available tags and their functions. | Tags | Function | Example | |------|---------|---------| | \`{b}\` | Bold | \`{b}Bold text{/b}\` | | \`{w}\` | Large font | \`{w}Large font text{/w}\` | | \`{s}\` | Small font | \`{s}Small font text{/s}\` | | \`{br}\` | Line break | \`{br}\` | | \`{left}\` | Align left | \`{left}Left aligned text{/left}\` | | \`{center}\` | Center text | \`{center}Centered text{/center}\` | | \`{qr}\` | Print a QR code representing the sent text | \`{qr}Text{/qr}\` | | \`{pdf417}\` | Print a barcode | \`{pdf417}Text{/pdf417}\` | See below an example of how to perform custom printing. * [java ](#editor%5F6) * [kotlin ](#editor%5F5) kotlin java ``` val bitmapPrinter = MPManager.bitmapPrinter val customTagToPrint: String = "{br}{b}Hello world{/b}{br}{br}{br}{s}this is a test text{/s}" val paymentMethodName: String? = null // Optional parameter that allows printing the name of the payment method used. val printPdf417InBoleta: Boolean? = null // Optional parameter that allows printing the pdf417 barcode (the stain). Default value: null bitmapPrinter.print(customTagToPrint, paymentMethodName, printPdf417InBoleta) { response -> response.doIfSuccess { printResult -> // Handle successful printing }.doIfError { error -> // Handle printing operation error } } ``` Copiar ``` final BitmapPrinter bitmapPrinter = MPManager.INSTANCE.getBitmapPrinter(); final String customTagToPrint = "{br}{b}Hello world{/b}{br}{br}{br}{s}this is a test text{/s}" @Nullable final String paymentMethodName; // Optional parameter that allows printing the name of the payment method used. @Nullable final Boolean printPdf417InBoleta; // Optional parameter that allows printing the pdf417 barcode (the stain). final Function1, Unit> callback = (final MPResponse response) -> { if (response.getStatus() == ResponseStatus.SUCCESS) { // Handle successful printing } else { // Handle printing operation error } return Unit.INSTANCE; }; bitmapPrinter.print(customTagToPrint, paymentMethodName, printPdf417InBoleta, callback); ``` Copiar ::: :::: ::::: :::AccordionComponent{title="External printing via Bluetooth"} To perform printing on an external printer, you must first \[pair it with the Point terminal via Bluetooth\](https://www.mercadopago.com.ar/developers/en/docs/smartapps/terminal-features/configure-bluetooth). After pairing, use the \`print\` function from the \`BluetoothPrinter\` class of the \`MPManager\` object to perform the printing. In the \`dataToPrint\` field, provide the text sequence to be printed. > NOTE > > If there is already a paired printer and you need to select it, use the search printers function to get its location. Then, provide the printer address in the \`address\` field. See below an example of how to perform printing. * [java ](#editor%5F8) * [kotlin ](#editor%5F7) kotlin java ``` val bluetoothPrinter = MPManager.bluetooth.printer bluetoothPrinter.print(dataToPrint, address) { response -> response .doIfSuccess { printerResult -> // Handle successful printing result when (printerResult) { BluetoothPrinterResult.SUCCESS -> { // Printing performed successfully // ... Perform additional actions if necessary } BluetoothPrinterResult.NEED_SELECTION_DEVICE -> { // More than one paired device, address must be specified // ... Perform additional actions if necessary } else -> { // Other successful result cases } } } }.doIfError { error -> // Handle error case if necessary } } ``` Copiar ``` final BluetoothPrinter bluetoothPrinter = MPManager.INSTANCE.getBluetooth().getPrinter(); final Function1, Unit> callback = (final MPResponse response) -> { if (response.getStatus() == ResponseStatus.SUCCESS) { // Perform additional actions if necessary } else { // Handle error case if necessary } return Unit.INSTANCE; }; bluetoothPrinter.print(dataToPrint, address, callback); ``` Copiar The response may contain the following information: | Field | Type | Description | |-------|------|-------------| | \`dataToPrint\` | String | Text sequence that will be printed. | | \`address\` | String | The address of the Bluetooth printer that will be used. | | Status | Description | |--------|-------------| | \`CONNECTION\_FAILED\` | The connection to the printer failed. | | \`ERROR\_UNDEFINED\` | An error of unknown cause occurred. | | \`SUCCESS\` | Printing was completed successfully. | | \`NEED\_SELECTION\_DEVICE\` | It is necessary to specify the printer address when there are multiple paired devices. | | \`ERROR\_DATA\_TO\_PRINT\_NULL\` | The data provided for printing is null. | | \`ERROR\_PRINTER\_NOT\_FOUND\` | No paired printer was found. | :::