|
@@ -1,39 +1,52 @@
|
|
|
<template>
|
|
|
- <div v-for="page in pages" :key="page" style="width: 100%;">
|
|
|
+ <div style="width: 100%;height:100%;position:absolute">
|
|
|
+ <!-- <el-watermark :font="font" :content="content" style="width: 100%;height:100%;position:absolute"> -->
|
|
|
+ <iframe style="width:100%;height:100%;border:none" :src="`${currentPdf}`" />
|
|
|
+ <!-- </el-watermark> -->
|
|
|
+ </div>
|
|
|
+ <!-- <div v-for="page in pages" :key="page" style="width: 100%;">
|
|
|
<VuePDF :pdf="pdf" fit-parent :watermark-text="watermarkText" :watermark-options="watermarkOptions" :page="page">
|
|
|
<div v-loading="true"></div>
|
|
|
</VuePDF>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import {ref, onMounted, watchEffect} from 'vue'
|
|
|
-import { VuePDF, usePDF } from '@tato30/vue-pdf'
|
|
|
+// import { VuePDF, usePDF } from '@tato30/vue-pdf'
|
|
|
import { propTypes } from '@/utils/propTypes';
|
|
|
+import base64 from 'base-64';
|
|
|
|
|
|
const props = defineProps({
|
|
|
src: propTypes.string.def(''),
|
|
|
});
|
|
|
+const content = ref(["text"])
|
|
|
+
|
|
|
+const font = ref({
|
|
|
+ color: 'rgba(0, 0, 0, .15)',
|
|
|
+})
|
|
|
|
|
|
|
|
|
const currentPdf = ref(props.src)
|
|
|
watchEffect(() => {
|
|
|
- currentPdf.value = props.src;
|
|
|
+
|
|
|
+ //http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(base64Encode(url))
|
|
|
+ currentPdf.value = `http://127.0.0.1:8012/onlinePreview?url=${encodeURIComponent(base64.encode(props.src))}&watermarkTxt=${encodeURIComponent('动态水印')}`;
|
|
|
|
|
|
// currentPdf.value = props.src.replaceAll("https://njdnyjsfilesystem.s3.cn-east-1.qiniucs.com","http://sdrqczwd3.hd-bkt.clouddn.com");
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-const { pdf, pages } = usePDF(currentPdf)
|
|
|
+// const { pdf, pages } = usePDF(currentPdf)
|
|
|
|
|
|
-const watermarkOptions = ref({
|
|
|
- columns: 4,
|
|
|
- rows: 10,
|
|
|
- color: 'rgba(211, 210, 211, 0.8)',
|
|
|
- rotation: 45,
|
|
|
- fontSize: 18,
|
|
|
-});
|
|
|
-const watermarkText = ref('sample')
|
|
|
+// const watermarkOptions = ref({
|
|
|
+// columns: 4,
|
|
|
+// rows: 10,
|
|
|
+// color: 'rgba(211, 210, 211, 0.8)',
|
|
|
+// rotation: 45,
|
|
|
+// fontSize: 18,
|
|
|
+// });
|
|
|
+// const watermarkText = ref('sample')
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|