Issue - when I print and image the text got smaller.

67 views
Skip to first unread message

Roberto

unread,
Jul 24, 2024, 2:23:23 PM7/24/24
to qz-print
I have the following html. It works fine but now i need sometime to print a base64 image for a QRcode and some others clients want to have their logo printed on the receipt on their thermal printer, but everytime i append a <img> tag woth any kind of image the text get smaller, and it get smaller with same proportion of the size of the image. 

You can see in the example 1 with no image added, example 2 image with medium size (QrCode), example 3 a big image got the text super small (this was just for an example, no client want it so big)

<html>
<head>
    <meta charset="utf-8">
    <style>
        th, td {
            font-size: 13px;
            font-family: Arial, Helvetica, sans-serif;
        }
        body {
            max-width: 270px;
        }
    </style>
</head>
<body>
    <table width="95%" align="center" border="0">
        <tr></tr>
        <tr>
            <td align="center" valign="top">
                <h3>Olha, eu posso te vender mais barato nas próximas compras</h3>
            </td>
        </tr>
        <tr>
            <td align="center" valign="top">
                <p>Leia nosso QRCode e se cadastre</p>
            </td>
        </tr>
        <tr>
            <td align="center" valign="top"></td>
        </tr>
        <tr>
            <td align="center" valign="top"></td>
        </tr>
    </table>
    <table width="95%" align="center" border="0">
        <tr>
            <td width="10%">&nbsp;</td>
            <td width="30%">&nbsp;</td>
            <td width="40%">&nbsp;</td>
            <td width="20%">&nbsp;</td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <strong><< PEDIDO #3517 iFood >></strong>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <strong>Delivery</strong>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <strong>REALIZE DELIVERY</strong><br/><br/>
            </td>
        </tr>
        <tr>
            <td colspan="2">Previsto: </td>
            <td colspan="2">12/07/2024 06:50</td>
        </tr>
        <tr>
            <td colspan="2">Entrega</td>
            <td colspan="2">12/07/2024 07:20</td>
        </tr>
        <tr>
            <td colspan="2">Cliente</td>
            <td colspan="2">PEDIDO DE TESTE - Leonardo Cavalcanti</td>
        </tr>
        <tr>
            <td colspan="2">Telefone</td>
            <td colspan="2">0800 705 4050</td>
        </tr>
        <tr>
            <td colspan="2">Localizador iFood</td>
            <td colspan="2">55800311</td>
        </tr>
        <tr>
            <td colspan="4">1 pedido(s) na sua loja</td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <br/><br/><strong><< ITENS DO PEDIDO >></strong><br/><br/>
            </td>
        </tr>
        <tr>
            <td align="left">1 UN</td>
            <td align="left" colspan="2" valign="top">PEDIDO DE TESTE - ITEM 1 - NÃO ENTREGAR</td>
            <td align="right">R$14,46</td>
        </tr>
        <tr>
            <td align="left">1 UN</td>
            <td align="left" colspan="2" valign="top">PEDIDO DE TESTE - ITEM 2 - NÃO ENTREGAR</td>
            <td align="right">R$15,83</td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <br/><br/><strong><< TOTAL >></strong><br/><br/>
            </td>
        </tr>
        <tr>
            <td colspan="3">Valor total dos itens</td>
            <td align="right">R$30,29</td>
        </tr>
        <tr>
            <td colspan="3">Taxa de entrega</td>
            <td align="right">R$10,00</td>
        </tr>
        <tr>
            <td colspan="3"><strong>VALOR TOTAL</strong></td>
            <td align="right"><strong>R$41,28</strong></td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <br/><br/><strong><< PAGAMENTO >></strong><br/><br/>
            </td>
        </tr>
        <tr>
            <td colspan="4">NÃO COBRAR NA ENTREGA</td>
        </tr>
        <tr>
            <td colspan="3">Pagamento online (Vale refeição)</td>
            <td align="right">R$41,28</td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <br/><br/><strong><< ENTREGA #3517 >></strong><br/><br/>
            </td>
        </tr>
        <tr>
            <td colspan="3">Horário:</td>
            <td align="right"><strong>07:20</strong></td>
        </tr>
        <tr>
            <td align="left" colspan="4">
                <strong>PEDIDO DE TESTE - LEONARDO CAVALCANTI</strong>
            </td>
        </tr>
        <tr>
            <td align="left" colspan="4">
                <strong>Rua TESTE, 999999</strong>
            </td>
        </tr>
        <tr>
            <td align="left" colspan="4">
                Complemento: <strong>Complemento TESTE</strong>
            </td>
        </tr>
        <tr>
            <td align="left" colspan="4">
                Referência: <strong>TESTE</strong>
            </td>
        </tr>
        <tr>
            <td align="left" colspan="4">
                <strong>Bairro TESTE</strong>
            </td>
        </tr>
        <tr>
            <td align="left" colspan="4">TESTE - XX</td>
        </tr>
        <tr>
            <td align="left" colspan="4" valign="top">
                <br><br>
                <p width="95%" align="center">impresso por</p>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="4" valign="top">
                <strong>| KDoQ Delivery</strong> - Realize TI |
            </td>
        </tr>
    </table>
</body>
</html>
WhatsApp Image 2024-07-24 at 15.21.00.jpeg

Lite Finocchiaro

unread,
Jul 24, 2024, 2:44:19 PM7/24/24
to Roberto, qz-print
Roberto:

On thermal receipt printers, we recommend using the tallest possible height for the default paper size. If the height is set to anything smaller, the scaleContent behavior will shrink the HTML content to match the height provided by the driver, making the content more narrow and the letters smaller by consequence.

You should see an option to choose something like 80x3276mm in the driver (< in Windows, it will be 80x2000mm in MacOS and Linux PCs); that is what we recommend. The driver should trim any remaining whitespace from the bottom of the print job, and also cut the paper if the cutting option has been selected.

Regards,

Lite Finocchiaro
VP, QZ Industries

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qz-print/6771ac29-2163-456b-af54-30e31fd6b817n%40googlegroups.com.

Roberto

unread,
Jul 24, 2024, 2:54:16 PM7/24/24
to qz-print
Dear mr finocchiaro,

Thank you for the quick reply.

As i am new in this issue, can you please help me in a step by step how can I set  scaleContent  or where can check this option for size in the driver

Regards

Roberto

unread,
Jul 24, 2024, 3:04:30 PM7/24/24
to qz-print
I found how to set the scaleContent as false, and it is now printing in the correct size. 
however it is cutting the paper before the actual end of the paper.

is there anything I can do to print in a perfect size and cut the paper in the correct end of the receipt ?

Regards 

Lite Finocchiaro

unread,
Jul 24, 2024, 3:13:04 PM7/24/24
to Roberto, qz-print
Roberto:

Did you change the default paper size in the driver as I suggested?

Please use scaleContent: 'true' and increase the default paper size in the driver to 80x3276 (or the longest height value). Then you should get a good result.

Regards,

Lite



Roberto

unread,
Jul 24, 2024, 3:24:00 PM7/24/24
to qz-print
Can you please let me know where i can change de default paper size ?

Lite Finocchiaro

unread,
Jul 24, 2024, 5:27:11 PM7/24/24
to Roberto, qz-print
Roberto:

In Windows:

Control Panel > Devices and Printers > Receipt Printer (your printer is likely different from mine) > Printing Preferences > Paper Size (my screenshot shows Advanced Options because the Epson TM-T88V requires the APD [advanced printer driver] to change these parameters) . Screenshot attached.

Regards,

Lite

receiptPrinterMaxHeight.PNG

Roberto

unread,
Jul 24, 2024, 5:53:47 PM7/24/24
to qz-print
We have many clients, unfortunately it will be impossible to ask all of them to change their settings. 
what i did and it seems to be working, i changed my qztray settings to the below.

Do you think it willl be ok or maybe there will be any side effect ?

        printing: {
            /** Default options used for new printer configs. Can be overridden using {@link qz.configs.setDefaults}. */
            defaultConfig: {
                //value purposes are explained in the qz.configs.setDefaults docs

                bounds: null,
                colorType: 'color',
                copies: 1,
                density: 0,
                duplex: false,
                fallbackDensity: null,
                interpolation: 'bicubic',
                jobName: null,
                legacy: false,
                margins: 0,
                orientation: null,
                paperThickness: null,
                printerTray: null,
                rasterize: false,
                rotation: 0,
                scaleContent: true,
                units: 'in',
                size:  { width: 80, height: 3276},
                altPrinting: false,
                encoding: null,
                spool: null
            }
        },

Lite Finocchiaro

unread,
Jul 24, 2024, 6:10:23 PM7/24/24
to Roberto, qz-print
Roberto:

I have provided the best solution to your problem already; while it may not scale well for multiple users, I stand by its reliability to resolve your issue.

If providing different size parameters in QZ-Tray overrides the driver settings and that works, then that's great, but we cannot guarantee that this will work for all makes and models.

Also, I see that you have specified inches "in" instead of millimeters "mm"; you may see some scaling issues with this configuration.

Regards,

Lite


Roberto

unread,
Jul 26, 2024, 10:53:42 AM7/26/24
to qz-print
Unfortunately the configuration i sent you before did not work in some long receipts because The printer is cutting it before it ends.

And unfortunately, your sugestion for changing the print setting did not work either because most of printers (example of bematech Mp-4200) does not have   80x3276 which paper size

Is there anything else I can try to make the print cut it in the end of the paper without change the print size or shrink it ?

bematech.png

Lite Finocchiaro

unread,
Jul 26, 2024, 11:44:11 AM7/26/24
to Roberto, qz-print
Roberto:

I'm sorry for the trouble, but we have no control over the paper sizes offered by the driver.

You could try to leverage rawHTML using ESC/POS, which is supported by this printer. 


rawHTML will require some trial and error to get the scaling correct (the width is the important factor here), but it works. There may be some slight differences between printers with different DPI print heads, however. My Epson TM-T88V is 180dpi, for example, while the 4200 TH is 203dpi.

The other option would be to leverage pure ESC/POS. It may take a while to get the template perfect, but this results in the fastest prints.


If you have any other questions, please let us know.

Regards,

Lite

Roberto

unread,
Jul 26, 2024, 12:18:16 PM7/26/24
to qz-print
Thank you, 

I will try and do some tests.

One last thing, do you have any kind of full documentation off all configuration options of qztray or step by step ?

I am completely lost in the  https://qz.io/docs/raw#escpos-2 you sent

Regards

Lite Finocchiaro

unread,
Jul 26, 2024, 1:37:48 PM7/26/24
to Roberto, qz-print
Roberto:

below is our API


If you get stuck on something just let us know.

Cheers,

Lite

Reply all
Reply to author
Forward
0 new messages