electron-pos-printer icon indicating copy to clipboard operation
electron-pos-printer copied to clipboard

Length of label is really long and unable to shorten it.

Open RosiersRobin opened this issue 10 months ago • 0 comments

I have A QR code that I want to print, but the label is 3x the lenght of the QR code. It gets automatically cut by the label printer (QL-800) but 3x the size in lenght of the size of the QR code.

I want to print 29mmx29mm labels.

This is what I got for settings:

const dpiX = 300;
const dpiY = 300;
const mmToInches = 0.0393701; // Conversion factor from mm to inches
// Desired page size in millimeters
const pageSizeInMM = {
    width: 29,
    height: 29,
};

// Convert mm to inches
const pageSizeInInches = {
    width: pageSizeInMM.width * mmToInches,
    height: pageSizeInMM.height * mmToInches,
};

// Calculate page size in dots
const pageSizeInDots = {
    width: Math.round(pageSizeInInches.width * dpiX),
    height: Math.round(pageSizeInInches.height * dpiY),
};

const options = {
    preview: false,                // Preview in window or print
    silent: true,                 // Print silently
    margin: '0 0 0 0',            // margin of content body
    copies: 1,                    // Number of copies to print
    printerName: 'QL-800',
    timeOutPerLine: 5000,
    pageSize: {
        height: 29000,
        width: pageSizeInDots.width,
    }
}
const data = [
    {
        type: 'qrCode',
        value: 'Whatever I want in the QR code',
        position: 'center',
        height: "29",
        width: "29",
    },
];

The QR is 👌 , but the label is too long and this would cause a lot of waste of time and paper because the user would need to cut the label to the desired size every single time.

Anyone wha would be able to assist me in this?

Thakns in advance!

RosiersRobin avatar Aug 21 '23 18:08 RosiersRobin