When I load complete document in mobile safari,its running out of memory and the browser crashes,
So, I want to render single page at one time with having all features.
Is it possible to render single page and if how ?
You have to modify standard viewer to limit display to one page (e.g. fake number of pages in the api).
Mobile safari has defect in range request handling, so we disable fetching only portion of the document on this browser.
Closing as answered.
Thank you!! I have rendered single page by modifying viewer.js and i am unable to search the words. Find Control searches for the first word and it unable to scroll to next word. For loading a single page , i loaded all the pages and made the viewer division as null. Please help me this is critical issue for us.
hello~ would you mind share how you render just one page by modifying viewer.js? Thanks!
@yurydelendik How did you modify the limit display of page ?
Is there any specific property ?
@eghazal1 @chunyenHuang if you're curious, I was able to modify the number of pages displayed by doing something like:
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
}
You may run into issues with the find controller as described above and other edge cases that I haven't tested yet. I used defineProperty since document.numPages doesn't have a setter. You could also modify the pdf_viewer.js code to add a setter for numPages to avoid that.
Most helpful comment
hello~ would you mind share how you render just one page by modifying viewer.js? Thanks!