window.addEventListener("load", () => {
let pdfButton = document.querySelector("#pdf");
pdfButton.addEventListener("click", downloadPDF);
});
const downloadPDF = () => {
const url = "http://localhost:8080/pdf/Fedor_Prilutskiy";
try {
const xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = "blob";
xhr.send();
xhr.onload = () => {
console.log(xhr.response);
}
} catch (error) {
console.error(error);
}
}