Skip to content

I'm trying to figure out HTML in raw printing. #1332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
BrunolourencoLucas opened this issue Apr 7, 2025 · 3 comments
Open

I'm trying to figure out HTML in raw printing. #1332

BrunolourencoLucas opened this issue Apr 7, 2025 · 3 comments

Comments

@BrunolourencoLucas
Copy link

BrunolourencoLucas commented Apr 7, 2025

Hello, I'm just trying to figure out HTML printing. Every time I send a print job, it doesn't print the HTML; it only outputs a blank space. Here is my code:

                var size = {paper: data.pedido.modelos.etiquetaConfig.width, col: data.pedido.pedidoConfig[0].colunas}
                var config = getUpdatedConfig(imp, {
                    quant: data.pedido.copies, rotation: 0,
                    size: paperWidth(size),
                    height: parseFloat(data.pedido.pedidoConfig[0].height)
                });
                var options = {
                    pageWidth: paperWidth(size, true),
                    pageHeight: parseFloat(data.pedido.pedidoConfig[0].height)
                }
                var opts = getUpdatedOptions(options);
                var data = [
                          '^XA\n',
                          '^FT79,230^A0B,17,19,TT0003M_^FH198,1,0,R^FH\^FDTAM:G COL:2402 G:06^FS',
                           {
                              type: 'raw', format: 'html', flavor: 'file',
                              data: 'C:\\xampp\\htdocs\\public\\html.html',
                              options: { language: "ZPL",pageWidth:105,pageHeight:85 } // , "pageWidth":..., "pageHeight":... },
                           },
                           '^PQ1',
                           '^XZ\n'
                ]

                //'C:\\xampp\\htdocs\\writable\\teste\\html.html',
                console.log(config);
                console.log(options);
                console.log(data);
                if (qz.websocket.isActive()) {
                    qz.print(config, data).then(() => {
                        event({ref: id, type: 'impressao', val: grade})
                        qz.printers.stopListening();
                        loaderbut(true);
                    }).catch(displayError);
                } else {
                    startConnection()
                    setTimeout(function () {
                        qz.print(config, data).then(() => {
                            event({ref: id, type: 'impressao', val: grade})
                            qz.printers.stopListening();
                            loaderbut(true);
                        }).catch(displayError);
                    }, 100)
                }

I can print if I use pixel printing, but every time I print a label, I receive a paper jam error. I can't figure out why.

@BrunolourencoLucas BrunolourencoLucas changed the title i'm trying to figure out html in raw print I'm trying to figure out HTML in raw printing. Apr 7, 2025
@BrunolourencoLucas
Copy link
Author

BrunolourencoLucas commented Apr 7, 2025

i'm using a TSC TTP2410NT as printer, if i use a http path to the html file, i get the same result.
i have put this line to test "'^FT79,230^A0B,17,19,TT0003M_^FH198,1,0,R^FH\^FDTAM:G COL:2402 G:06^FS', < this prints normally, but the html does not, if i remove i only get a blank page

@tresf
Copy link
Contributor

tresf commented Apr 7, 2025

Gotcha. We'll take a look and let you know what we find. It might be a couple of days.

@lite1979
Copy link
Contributor

lite1979 commented Apr 16, 2025

pageWidth:105,pageHeight:85

I tried using "pageWidth: 105" (this is called Render Width on the website) at https://demo.qz.io using the Raster Print > HTML (ZPLII) function to print to my Zebra GK420d (203 dpi), and I also got a blank page.

This is because the pageWidth parameter is measured in "dots", meaning that a 203 dots-per-inch (DPI) printer is trying to fit the HTML content on an area that is approximately one half inch wide and less than a half inch tall, and the print result fails to render on such a small printable area with such a low DPI.

Raw languages do not comprehend the "units" from pixel printing, so some knowledge of the printer's hardware is required to achieve good results when leveraging rawHTML, rawPDF or rawImage functions, specifically the dpi of the printhead as it relates to the width and height of the paper/labels.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants