-
Hi! Is there any way to display the current page the user will be looking at? |
Beta Was this translation helpful? Give feedback.
Answered by
hrynko
Sep 30, 2022
Replies: 1 comment
-
Hi @m-briceno, Please check the Examples section of README.md. There is an example of displaying the page number and the number of pages. In essence: <template>
<div>
<template v-if="pageCount">
<button :disabled="page <= 1" @click="page--">
Previous
</button>
{{ page }} / {{ pageCount }}
<button :disabled="page >= pageCount" @click="page++">
Next
</button>
</template>
<vue-pdf-embed
:source="pdfSource"
:page="page"
@loaded="handleDocumentLoad"
/>
</div>
</template>
<script>
import VuePdfEmbed from 'vue-pdf-embed'
export default {
components: {
VuePdfEmbed,
},
data() {
return {
page: 1,
pageCount: null,
pdfSource: '<PDF_SOURCE>',
}
},
methods: {
handleDocumentLoad({ numPages }) {
this.pageCount = numPages
},
},
}
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
m-briceno
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @m-briceno,
Please check the Examples section of README.md. There is an example of displaying the page number and the number of pages. In essence: