ZhangXianQiang
2024-07-03 9375e267e1e00132560e41a9757d583ff45f6fec
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
<template>
  <div class="pdf-container">
    <canvas ref="pdfCanvas" class="pdf-canvas"></canvas>
  </div>
</template>
 
<script setup>
import { ref,onMounted } from 'vue';
 
const props = defineProps({
  pdfUrl: {
    type: String,
    required: true
  }
})
const pdfCanvas = ref(null);
 
const renderPDF = () => {
  const url = props.pdfUrl;
  console.log(window.pdfjsLib);
}
 
onMounted(() => {
  renderPDF();
})
 
</script>
 
<style lang="scss" scoped>
.pdf-container {
  width: 100%;
  height: 100%;
 
  .pdf-canvas {
    width: 100%;
    height: 100%;
  }
}
</style>