-
Hello, I have a problem where I want to display a long PDF (over 6000 pages), but only blank pages are being rendered. If I filter by single page, it works fine. I wanted to integrate pagination, but I can't find a way to display a range of pages, for example, pages 1 to 50. How can I do this? thanks, Regards |
Beta Was this translation helpful? Give feedback.
Answered by
hrynko
Oct 5, 2023
Replies: 1 comment
-
Hi @antoinedu06160, Indeed, I would recommend displaying large documents paginated (page by page or within ranges). At some point some kind of lazy loading could be added to the lib, but for now you could use it as follows: <template>
<div v-if="pdfSource">
<vue-pdf-embed
v-for="page in pages"
:key="page"
:source="pdfSource"
:page="page"
/>
</div>
</template>
<script>
import VuePdfEmbed from 'vue-pdf-embed'
export default {
components: {
VuePdfEmbed,
},
data() {
return {
pages: [...Array(51).keys()].slice(1),
pdfSource: null,
}
},
async mounted() {
this.pdfSource = await VuePdfEmbed.getDocument('<PDF_URL>').promise
},
}
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @antoinedu06160,
Indeed, I would recommend displaying large documents paginated (page by page or within ranges). At some point some kind of lazy loading could be added to the lib, but for now you could use it as follows: