Browse Source

fix: add pdf-object

pull/8990/head
DarkPhoenix2704 4 months ago
parent
commit
7c72c22567
No known key found for this signature in database
GPG Key ID: 3F76B10622A07849
  1. 11
      packages/nc-gui/components/cell/attachment/Preview/Pdf.vue
  2. 5
      packages/nc-gui/plugins/pdf-object.ts

11
packages/nc-gui/components/cell/attachment/Preview/Pdf.vue

@ -40,17 +40,18 @@ const openMethod = ref<'browser' | 'google' | undefined>()
</div> </div>
</div> </div>
<iframe <pdf-object
v-if="openMethod === 'browser'" v-if="openMethod === 'browser'"
:class="props.class" :class="props.class"
:src="src[currentIndex]" :url="src[currentIndex]"
width="100%" class="w-full h-full"
height="100%"
@error="handleError" @error="handleError"
></iframe> />
<iframe <iframe
v-else-if="openMethod === 'google'" v-else-if="openMethod === 'google'"
:class="props.class" :class="props.class"
type="application/pdf"
:src="`https://docs.google.com/viewer?url=${encodeURIComponent(src[currentIndex])}&embedded=true`" :src="`https://docs.google.com/viewer?url=${encodeURIComponent(src[currentIndex])}&embedded=true`"
width="100%" width="100%"
height="100%" height="100%"

5
packages/nc-gui/plugins/pdf-object.ts

@ -0,0 +1,5 @@
import PDFObjectPlugin from 'pdfobject-vue'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(PDFObjectPlugin)
})
Loading…
Cancel
Save