-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathabout.js
46 lines (39 loc) · 1.32 KB
/
about.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const pdfFile = "./Project_Proposal.pdf"; // file
function loadAndDisplayPDF(pdfFile) {
const pdfContainer = document.getElementById("pdf-container");
// Initialize PDF.js
pdfjsLib.getDocument(pdfFile).promise.then(function (pdf) {
for (let pageNumber = 0; pageNumber <= pdf.numPages; pageNumber++) {
pdf.getPage(pageNumber).then(function (page) {
const viewport = page.getViewport({ scale: 1 });
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
canvas.height = viewport.height;
canvas.width = viewport.width;
const renderContext = {
canvasContext: context,
viewport: viewport,
};
// Render the page as an image
page.render(renderContext).promise.then(function () {
pdfContainer.appendChild(canvas);
});
});
}
});
}
// Load and display the PDF
loadAndDisplayPDF(pdfFile);
/////////////////////////////////////////////////
// embedded nav bar
fetch("./nav.php")
.then(response => response.text())
.then(content => {
document.getElementById("embeddedNav").innerHTML = content;
});
// embedded footer
fetch("./footer.html")
.then(response => response.text())
.then(content => {
document.getElementById("embeddedFooter").innerHTML = content;
});