Skip to content

Commit

Permalink
refactor(pdfmake): add pdfmake via script instead of esm import
Browse files Browse the repository at this point in the history
  • Loading branch information
BayBreezy committed Jun 19, 2023
1 parent 53c7bc4 commit 2e915d7
Show file tree
Hide file tree
Showing 9 changed files with 7,340 additions and 873 deletions.
31 changes: 31 additions & 0 deletions docs/components/content/BasicExample.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<main class="w-full divide-x flex justify-center">
<div class="w-1/2 h-screen bg-red-50"></div>
<div class="w-1/2 h-screen bg-blue-50">
<VuePDF :pdf="pdfLink" v-if="pdfLink" fit-parent />
</div>
</main>
</template>

<script setup lang="ts">
import { VuePDF, usePDF } from "@tato30/vue-pdf";
const { $pdfMake: pdf } = useNuxtApp();
const pdfLink = ref("");
const loadPdf = () => {
pdf
.createPdf({
content: [
"First paragraph",
"Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines",
],
})
.getDataUrl((dataUrl) => {
pdfLink.value = dataUrl;
});
};
onMounted(() => {
loadPdf();
});
</script>
4 changes: 4 additions & 0 deletions docs/content/2.examples/1.basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Basic

::BasicExample

2 changes: 0 additions & 2 deletions docs/content/2.examples/1.documentation.md

This file was deleted.

2 changes: 2 additions & 0 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default defineNuxtConfig({
"@nuxtjs/plausible",
// https://github.com/nuxt/devtools
"@nuxt/devtools",
"nuxt-pdfmake",
"@nuxthq/ui",
],

css: ["~/assets/main.css"],
Expand Down
Loading

0 comments on commit 2e915d7

Please sign in to comment.