“` // Check if a PDF file is passed in the URL
const urlParams = new URLSearchParams(window\.location.search);
const fileUrl = urlParams.get(‘file’);if (fileUrl) {
fetch(fileUrl)
.then(res => res.arrayBuffer())
.then(async (data) => {
pdfDoc = await PDFLib.PDFDocument.load(data);
alert(“PDF loaded from link: ” + fileUrl);
})
.catch(() => alert(“Failed to load the PDF from the link.”));
}