hymhub / pdf-vue3

vue3 pdf viewer
https://hymhub.github.io/pdf-vue3/
MIT License
76 stars 15 forks source link

feat: add onRendered emit with totalPages number #8

Closed dkudryk closed 10 months ago

hymhub commented 10 months ago

Updated version to change onRendered to onOnPdfInit?: ((pdf: PDFDocumentProxy) => any) | undefined; if you want to get the total page numbers after initialization:

template

<PDF
    src="xxx"
    @on-pdf-init="handlePdfInit"
/>

script

/**
 *
 * @param {import('pdf-vue3').PDFDocumentProxy} pdf - The PDF document proxy object.
 * @returns {void}
 */
const handlePdfInit = (pdf) => {
  console.log(pdf.numPages);
};

API:https://github.com/hymhub/pdf-vue3#events