-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
35 lines (31 loc) · 1.02 KB
/
index.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My PDF CV Preview</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js"></script>
</head>
<body>
<h1>My CV</h1>
<canvas id="pdf-canvas"></canvas>
<script>
// Initialize PDF.js
const url = "https://olekria.github.io/cv-en/CVswiss3-en.pdf";
const canvas = document.getElementById("pdf-canvas");
const context = canvas.getContext("2d");
pdfjsLib.getDocument(url).promise.then(function (pdf) {
pdf.getPage(1).then(function (page) {
const scale = 1.5; // Scale to adjust size
const viewport = page.getViewport({ scale: scale });
canvas.width = viewport.width;
canvas.height = viewport.height;
page.render({
canvasContext: context,
viewport: viewport,
});
});
});
</script>
</body>
</html>