Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/more props #33

Merged
merged 3 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default defineUserConfig({
docsDir: 'docs',
navbar: [
{
text: 'Guide',
link: '/guide/'
text: 'Docs',
link: '/guide/introduction.md'
},
{
text: 'Examples',
Expand All @@ -39,12 +39,18 @@ export default defineUserConfig({
{
text: 'Guide',
children: [
'/guide/README.md',
'/guide/introduction.md',
'/guide/composables.md',
],
},
{
text: 'VuePDF Component',
children: [
'/guide/props.md',
'/guide/events.md',
'/guide/methods.md',
'/guide/slots.md',
],
]
}
],
'/examples/': [
Expand Down
6 changes: 6 additions & 0 deletions docs/.vuepress/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@
border-radius: 4px;
border: none;
}

.container {
display: flex;
align-items:center;
flex-direction: column
}
21 changes: 20 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Home
# heroImage: /images/hero.png
actions:
- text: Get started
link: /guide/
link: /guide/introduction
type: primary
- text: Examples
link: /examples/basic/one_page
Expand All @@ -25,3 +25,22 @@ actions:
# details: Default bundler is Vite, while Webpack is also supported. Choose the one you like!
# footer: MIT Licensed | Copyright © 2018-present Evan You
---

<script setup>
import { ref } from 'vue'
import { VuePDF, usePDF } from '@tato30/vue-pdf';

const page = ref(1)
const { pdf, pages } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>

<div class="container">
<div>
<button class="button-example" @click="page = page > 1? page - 1 : page">PREV</button>
<span>{{page}}/{{pages}}</span>
<button class="button-example" @click="page = page < pages? page + 1 : page">NEXT</button>
</div>
<div style="width: 500px">
<VuePDF :pdf="pdf" :page="page" fit-parent />
</div>
</div>
4 changes: 2 additions & 2 deletions docs/examples/advanced/annotation_filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function reloadPage() {
</script>

<template>
<div style="text-align: center">
<div>
<div>
<select v-model="selectedFilter[0]" class="select-example" @change="reloadPage">
<option v-for="flt in filters" :key="flt" :value="flt">
Expand Down Expand Up @@ -45,7 +45,7 @@ function reloadPage() {
}
</script>

<div style="text-align: center">
<div class="container">
<div>
<select v-model="selectedFilter[0]" class="select-example" @change="reloadPage">
<option v-for="flt in filters" :key="flt" :value="flt">
Expand Down
12 changes: 6 additions & 6 deletions docs/examples/advanced/fit_parent.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ function fitParentWidth(pxs) {
</script>

<template>
<div style="text-align: center">
<div>
<div>
<button class="button-example" @click="fitParentWidth(-50)">
<button @click="fitParentWidth(-50)">
Remove 50px
</button>
<span>Parent width: {{ parentWidth }}px</span>
<button class="button-example" @click="fitParentWidth(50)">
<button @click="fitParentWidth(50)">
Add 50px
</button>
</div>
<div :style="`width: ${parentWidth}px; display: inline-block`">
<div :style="`width: ${parentWidth}px`">
<VuePDF ref="vuePDFRef" :pdf="pdf" fit-parent />
</div>
</div>
Expand All @@ -48,13 +48,13 @@ function fitParentWidth(pxs) {
}
</script>

<div style="text-align: center">
<div class="container">
<div>
<button class="button-example" @click="fitParentWidth(-50)">Remove 50px</button>
<span>Parent width: {{parentWidth}}px</span>
<button class="button-example" @click="fitParentWidth(50)">Add 50px</button>
</div>
<div :style="`width: ${parentWidth}px; display: inline-block`">
<div :style="`width: ${parentWidth}px`">
<VuePDF ref="vuePDFRef" :pdf="pdf" fit-parent />
</div>
</div>
7 changes: 3 additions & 4 deletions docs/examples/advanced/multiple_pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<script setup>
import { ref, watch } from 'vue'
import { VuePDF, usePDF } from '@tato30/vue-pdf'
import { withBase } from '@vuepress/client'

const currentPdfIndex = ref(0)
const pdfSources = [
Expand Down Expand Up @@ -33,9 +32,9 @@ function nextPdf() {
</script>

<template>
<div style="text-align: center">
<div>
<div>
<button class="button-example" @click="nextPdf">
<button @click="nextPdf">
Next PDF
</button>
</div>
Expand Down Expand Up @@ -75,7 +74,7 @@ function nextPdf() {
}
</script>

<div style='text-align: center'>
<div class="container">
<div>
<button class="button-example" @click="nextPdf">Next PDF</button>
</div>
Expand Down
12 changes: 7 additions & 5 deletions docs/examples/annotation_events/annotation_attachment.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ function onAnnotation(value) {
}
</script>

<div style="text-align: center">
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
</div>
<template>
<div>
<VuePDF :pdf="pdf" annotation-layer image-resources-path="https://unpkg.com/pdfjs-dist@latest/web/images/" @annotation="onAnnotation" />
</div>
</template>
```
<div class="language-json" data-ext="json">
<pre class="language-json"><code>// "content" is a uint8Array<br/>{{ eventValue }}</code></pre>
Expand All @@ -32,6 +34,6 @@ function onAnnotation(value) {
}
</script>

<div style="text-align: center">
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
<div class="container">
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" image-resources-path="https://unpkg.com/pdfjs-dist@latest/web/images/" />
</div>
10 changes: 6 additions & 4 deletions docs/examples/annotation_events/annotation_forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ function onAnnotation(value) {
}
</script>

<div style="text-align: center">
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
</div>
<template>
<div>
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
</div>
</template>
```
<div class="language-json" data-ext="json">
<pre class="language-json"><code>{{ eventValue }}</code></pre>
Expand All @@ -32,6 +34,6 @@ function onAnnotation(value) {
}
</script>

<div style="text-align: center">
<div class="container">
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
</div>
10 changes: 6 additions & 4 deletions docs/examples/annotation_events/annotation_links.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ function onAnnotation(value) {
}
</script>

<div style="text-align: center">
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
</div>
<template>
<div>
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
</div>
</template>
```
<div class="language-json" data-ext="json">
<pre class="language-json"><code>{{ eventValue }}</code></pre>
Expand All @@ -32,7 +34,7 @@ function onAnnotation(value) {
}
</script>

<div style="text-align: center">
<div class="container">
<VuePDF :pdf="pdf" annotation-layer @annotation="onAnnotation" />
<VuePDF :pdf="pdf" :page="6" annotation-layer @annotation="onAnnotation" />
</div>
2 changes: 1 addition & 1 deletion docs/examples/basic/all_pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ import { usePDF, VuePDF } from '@tato30/vue-pdf';
const { pdf, pages } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>

<div style="text-align: center" v-for="page in pages">
<div class="container" v-for="page in pages">
<VuePDF :pdf="pdf" :page="page" />
</div>
5 changes: 3 additions & 2 deletions docs/examples/basic/annotation_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
<script setup>
import { ref } from 'vue'
import { VuePDF, usePDF } from '@tato30/vue-pdf'
import '@tato30/vue-pdf/style.css'

const annotation_layer = ref(false)
const { pdf } = usePDF('example_014.pdf')
</script>

<template>
<div style="text-align: center">
<div>
<div>
<button @click="annotation_layer = !annotation_layer">
Change to {{ !annotation_layer }}
Expand All @@ -29,7 +30,7 @@ const annotation_layer = ref(false)
const { pdf } = usePDF(withBase('/example_014.pdf'))
</script>

<div style="text-align: center">
<div class="container">
<div>
<button class="button-example" @click="annotation_layer = !annotation_layer">
Change to <strong>{{ !annotation_layer }}</strong>
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/basic/one_page.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { pdf, pages } = usePDF('https://mozilla.github.io/pdf.js/web/compressed.t
</script>

<template>
<div style="text-align: center">
<div>
<div>
<button @click="page = page > 1 ? page - 1 : page">
Prev
Expand All @@ -32,7 +32,7 @@ const page = ref(1)
const { pdf, pages } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>

<div style='text-align: center'>
<div class="container">
<div>
<button class="button-example" @click="page = page > 1? page - 1 : page">PREV</button>
<span>{{page}}/{{pages}}</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/basic/rotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edea
</script>

<template>
<div style="text-align: center">
<div>
<div>
<button @click="rotation = rotation - 90">
-90
Expand All @@ -32,7 +32,7 @@ const rotation = ref(0)
const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>

<div style="text-align: center">
<div class="container">
<div>
<button class="button-example" @click="rotation = rotation - 90">
- 90°
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/basic/scale.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edea
</script>

<template>
<div style="text-align: center">
<div>
<div>
<button @click="scale = scale > 0.25 ? scale - 0.25 : scale">
-
Expand All @@ -32,7 +32,7 @@ const scale = ref(1)
const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>

<div style="text-align: center">
<div class="container">
<div>
<button class="button-example" @click="scale = scale > 0.25 ? scale - 0.25 : scale">
-
Expand Down
6 changes: 4 additions & 2 deletions docs/examples/basic/text_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
<script setup>
import { ref } from 'vue'
import { VuePDF, usePDF } from '@tato30/vue-pdf'
import '@tato30/vue-pdf/style.css'

const text_layer = ref(false)
const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>

<template>
<div style="text-align: center">
<div>
<div>
<button @click="text_layer = !text_layer">
Change to {{ !text_layer }}
Expand All @@ -23,12 +24,13 @@ const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edea
<script setup>
import { ref } from 'vue'
import { VuePDF, usePDF } from '@tato30/vue-pdf'
import '@tato30/vue-pdf/style.css'

const text_layer = ref(false)
const { pdf } = usePDF('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
</script>

<div style="text-align: center">
<div class="container">
<div>
<button class="button-example" @click="text_layer = !text_layer">
Change to <strong>{{ !text_layer }}</strong>
Expand Down
10 changes: 6 additions & 4 deletions docs/examples/loaded_events/loaded.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ function onLoaded(value) {
}
</script>

<div style="text-align: center">
<VuePDF :pdf="pdf" @loaded="onLoaded" />
</div>
<template>
<div>
<VuePDF :pdf="pdf" @loaded="onLoaded" />
</div>
</template>
```
<div class="language-json" data-ext="json">
<pre class="language-json"><code>{{ eventValue }}</code></pre>
Expand All @@ -32,6 +34,6 @@ function onLoaded(value) {
}
</script>

<div style="text-align: center">
<div class="container">
<VuePDF :pdf="pdf" @loaded="onLoaded" />
</div>
Loading