I’m using Laravel 10 now I try to Print label with Dymo LableWriter 450 with sdk but it give me CORS error can Anyone help me ?
function loadLabel() {
if (dymo.label.framework) {
dymo.label.framework.init(function() {
var labelXmlPath = '/Label1.dymo';
var xhr = new XMLHttpRequest();
xhr.open('GET', labelXmlPath, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var labelXml = xhr.responseText;
if (labelXml) {
var label = dymo.label.framework.openLabelXml(labelXml);
console.log('Label loaded successfully:', label);
console.log('Label XML:', label.getLabelXml());
if (label.isDCDLabel()) {
console.log('This is a DCD label.');
} else {
console.log('This is not a DCD label.');
}
var printers = dymo.label.framework.getPrinters();
if (printers.length == 0) {
throw "No DYMO printers are installed. Install DYMO printers.";
}
var printerName = "";
for (var i = 0; i < printers.length; ++i) {
var printer = printers[i];
if (printer.printerType == "LabelWriterPrinter") {
printerName = printer.name;
break;
}
}
label.print(printerName);
} else {
console.error(
'Error loading label XML. The content is empty or undefined.');
}
} else {
console.error('Error loading label XML. HTTP status:', xhr.status);
}
}
};
xhr.send();
});
} else {
console.error('DYMO Label Framework is not available.');
}
}
this is my code but it give me error how can I handle CORS please give me any solution . Any other sdk or any other solution with third party if anyone work with this