|
@@ -1,14 +1,17 @@
|
|
|
<template>
|
|
|
<div style="width: 100%;height:100%;position:absolute">
|
|
|
- <!-- <el-watermark :font="font" :content="content" style="width: 100%;height:100%;position:absolute"> -->
|
|
|
- <iframe v-loading="true" style="width:100%;height:100%;border:none" :src="`${currentPdf}`" />
|
|
|
- <!-- </el-watermark> -->
|
|
|
+
|
|
|
+ <el-watermark :font="font" :content="watertext" style="width: 100%;height:100%;position:absolute">
|
|
|
+ <iframe v-loading="true" style="width:100%;height:100%;border:none" :src="`${currentPdf}`" v-if="usepdf" />
|
|
|
+ <div style="height: 100%;overflow-y: auto" v-if="!usepdf">
|
|
|
+ <!-- <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>
|
|
|
+ </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> -->
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
import {ref, onMounted, watchEffect} from 'vue'
|
|
@@ -21,9 +24,9 @@ import useUserStore from '@/store/modules/user';
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
-const { watermark } = toRefs<any>(
|
|
|
+const { watermark } = toRefs<any>();
|
|
|
|
|
|
-);
|
|
|
+const usepdf=ref(true);
|
|
|
|
|
|
const props = defineProps({
|
|
|
src: propTypes.string.def(''),
|
|
@@ -39,11 +42,15 @@ const watertext = ref();
|
|
|
|
|
|
const currentPdf = ref(props.src)
|
|
|
watchEffect(() => {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (usepdf.value) {
|
|
|
+ // currentPdf.value = `/preview/onlinePreview?url=${encodeURIComponent(base64.encode(props.src))}&watermarkTxt=${encodeURIComponent(watertext.value)}`;
|
|
|
+ currentPdf.value = `/preview?url=${encodeURIComponent(props.src)}`
|
|
|
+ // http://localhost:8083/preview/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmozilla%2Fpdf.js%2Fba2edeae%2Fweb%2Fcompressed.tracemonkey-pldi-09.pdf
|
|
|
+ } else {
|
|
|
+ currentPdf.value = props.src;
|
|
|
+ }
|
|
|
//http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(base64Encode(url))
|
|
|
- currentPdf.value = `/preview/onlinePreview?url=${encodeURIComponent(base64.encode(props.src))}&watermarkTxt=${encodeURIComponent(watertext.value)}`;
|
|
|
+
|
|
|
|
|
|
// currentPdf.value = props.src.replaceAll("https://njdnyjsfilesystem.s3.cn-east-1.qiniucs.com","http://sdrqczwd3.hd-bkt.clouddn.com");
|
|
|
})
|
|
@@ -59,15 +66,6 @@ onMounted(()=>{
|
|
|
|
|
|
|
|
|
// 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')
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|