לי יש פונקציה כזו שמבצעת הדפסה מקובץ PDF (דינאמי הנוצר בשרת nodejs)
Print() {
const url = `api/print`
const options = {}
options.responseType = 'blob'
useJwt.axiosIns.get(url, options).then(response => {
console.log(response.data)
const a = document.createElement('a')
// eslint-disable-next-line no-shadow
const url = URL.createObjectURL(new Blob([response.data]))
a.href = url
// eslint-disable-next-line prefer-destructuring
const name = response.headers['content-disposition'].split(';')[1].split('=')[1].split('.')
a.download = `${decodeURI(name[0])}.${decodeURI(name[1])}`
document.body.append(a)
a.click()
a.remove()
URL.revokeObjectURL(url)
return true
}).catch(error => {
console.log(error)
this.$swal({
title: 'שגיאה בהדפסה!',
icon: 'error',
customClass: {
confirmButton: 'btn btn-primary',
},
buttonsStyling: false,
})
})
}