0
I have an API in Laravel that has an end-point (POST method) to generate PDF (Dompdf) with the following method:
public function generatePDF()
{
return \PDF::loadView('mailing::templates.pdf.model')->download('nome-arquivo-pdf-gerado.pdf');
}
I did the test by Insomnia and the PDF is generated normally, but in my front end (Vuejs) the whole document is blank without any information.
downloadPDF() {
download(this.compose)
.then((response) => {
this.saving = false;
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
link.click();
})
.catch((error) => {
console.error(error);
});
},
What could be causing this problem?