Contact Support
Load N number of pages on initial loading
6 Dec 20241 minute to read
The initial rendering in a PDF viewer allows users to control the number of pages displayed when opening a PDF document. This improves the user experience by providing flexibility in loading a specific number of pages initially, while additional pages are dynamically rendered as the user scrolls through the document. This approach enhances the responsiveness of the PDF viewer and minimizes delays as users can access specific pages without waiting for the entire document to load.
To utilize this capability in Syncfusion® PDF Viewer, use the initialRenderPages property. You can achieve the desired outcome by setting this property to the desired number of pages you want to load initially. However, it’s important to exercise caution when setting a high value for the initialRenderPages in large documents with numerous pages. Rendering a large number of pages simultaneously can increase memory usage and slow down loading times, impacting the performance of the PDF viewer.
Using the initialRenderPages
property judiciously is advisable, especially when dealing with larger documents. It is more suitable for scenarios where a smaller range of pages, such as 10-20, can be loaded to provide a quick initial view of the document.
```cs
@{
ViewBag.Title = "Home Page";
double InitialRenderPages = 10;
}
<div>
<div style="height:100%; width: 100%;">
@Html.EJS().PdfViewer("pdfviewer").DocumentPath("https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf").InitialRenderPages(InitialRenderPages).Render()
</div>
</div>
```
```cs
@{
ViewBag.Title = "Home Page";
double InitialRenderPages = 10;
}
<div>
<div style="height:100%; width: 100%;">
@Html.EJS().PdfViewer("pdfviewer").ServiceUrl(VirtualPathUtility.ToAbsolute("~/Home/")).DocumentPath("https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf").InitialRenderPages(InitialRenderPages).Render()
</div>
</div>
```