|
|
|
@ -204,13 +204,21 @@ async function onPrint(row: any) {
@@ -204,13 +204,21 @@ async function onPrint(row: any) {
|
|
|
|
|
const res = await getDeviceLabelBase64(row.id) |
|
|
|
|
closeLoadingPrint() |
|
|
|
|
if (isResError(res)) return |
|
|
|
|
const pdf = new jsPDF('l', 'mm', [60, 40]) |
|
|
|
|
const pdf = new jsPDF({ |
|
|
|
|
orientation: 'l', |
|
|
|
|
unit: 'mm', |
|
|
|
|
format: [60, 40], |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const imgData = res.data |
|
|
|
|
const imgWidth = 60 |
|
|
|
|
const imgHeight = 40 |
|
|
|
|
|
|
|
|
|
pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight) |
|
|
|
|
// const isEdge = navigator.userAgent.indexOf('Edg') !== -1 |
|
|
|
|
// if (isEdge) { |
|
|
|
|
// pdf.addImage(imgData, 'PNG', 2, -2, imgWidth, imgHeight) |
|
|
|
|
// } else { |
|
|
|
|
pdf.addImage(imgData, 'PNG', 2, -2, imgWidth, imgHeight) |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
pdf.autoPrint() |
|
|
|
|
window.open(pdf.output('bloburl'), '_blank') |
|
|
|
|