How to limit PDF Viewer to render limited number pages?

1 Answer 146 Views
PDFViewer
Daniil
Top achievements
Rank 1
Daniil asked on 04 Dec 2023, 03:55 PM

Hello,

I'm using PDF Viewer with PDF.js processing and want to limit the number of pages displayed when receiving a large PDF file because its rendering makes the page load very slow.

For example, I receive a file with 100 pages from the server and I want to render and display only the first 10, and if the user wants to view the rest, he can download the entire file.

I found some solution on github, but it requires changes to the source code of the kendo.js library. Can I do something similar with just the PDF Viewer API?

const MAX_PAGES = 3; PDFJS.getDocument(params).then((doc) => { Object.defineProperty(doc, 'numPages', { value: Math.min(doc.numPages, MAX_PAGES) }); this.pdfViewer.setDocument(doc); // Other stuff }

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 07 Dec 2023, 11:56 AM

Hi Daniil,

The PDFViewer API does not provide a built-in method for limiting the page count from the loaded PDF file. The PDFViewer does not have a suitable method or event that can be used to prevent a specific page(s) from loading.

I would suggest logging the idea as a Feature Request in our official Feedback Portal. Thus, the other users could vote for the idea and based on the popularity of the issue it could be considered for implementation.

- https://feedback.telerik.com/kendo-jquery-ui

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
PDFViewer
Asked by
Daniil
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or