qzind / tray

Browser plugin for sending documents and raw commands to a printer or attached device.
https://qz.io
Other
823 stars 266 forks source link

Did not print label on Dymo LabelWriter 450 #1270

Closed AzharAbbas10 closed 1 day ago

AzharAbbas10 commented 4 days ago

Following is my code

    function loadLabel() {
            // Connect to QZ Tray WebSocket
            qz.websocket.connect().then(() => {
                console.log("Connected to QZ Tray");

                // Find the specified printer
                return qz.printers.find("Dymo LabelWriter 450");
            }).then((printer) => {
                if (!printer) {
                    throw new Error("Printer not found");
                }
                console.log("Printer found:", printer);

                // Fetch the label definition from the public folder
                return fetch('/Label1.dymo')
                    .then(response => {
                        if (!response.ok) {
                            throw new Error('Network response was not ok');
                        }
                        return response.text();
                    }).then(labelContent => {
                        console.log("Label content fetched:", labelContent);

                        // Print job configuration
                        var config = qz.configs.create(printer);

                        // Send print job to QZ Tray
                        return qz.print(config, [{
                            type: 'raw',
                            format: 'image',
                            data: labelContent
                        }]);
                    });
            }).then(() => {
                console.log("Print job sent successfully");
            }).catch(function(err) {
                console.error('Error fetching or printing label:', err);
            });
        }
    it show this message in console but nothing print
    Print job sent successfully
tresf commented 2 days ago

What format is '/Label1.dymo'?

AzharAbbas10 commented 1 day ago

What format is '/Label1.dymo'? it is Xml First I created in Dymo Connect then I try to print

AzharAbbas10 commented 1 day ago
function loadLabel(printer) {
        const labelContent = `
    N
    A50,50,0,4,1,1,N,"Order ID: 123456"
    A50,100,0,4,1,1,N,"Client ID: 78910"
    A50,150,0,4,1,1,N,"Order Date: 2024-06-27"
    A50,200,0,4,1,1,N,"Fault: None"
    A50,250,0,4,1,1,N,"PIN: 1234"
    A50,300,0,4,1,1,N,"Auth Reset: Yes"
    B50,350,0,1,2,2,100,B,"https://example.com"
    P1
`;

        const config = qz.configs.create(printer);

        // Send the print job using QZ Tray
        qz.print(config, [{
            type: 'raw',
            format: 'plain',
            data: labelContent
        }]).then(() => {
            console.log('Print job sent successfully');
        }).catch((err) => {
            console.error('Error sending print job:', err);
        });
    }

I use this code but still not print it show message in console Print job sent successfully but it not print any thing

tresf commented 1 day ago

Tha appears to be EPL, which the label writer doesn't support.

tresf commented 1 day ago

Please ensure that the data format being sent to your printer is supported. EPL is a Zebra standard. It is emulated by many printer manufacturers, but at time of writing this, I'm unaware of any way to use it with a Dymo printer.