Contact Support
PageRenderInitiate and PageRenderComplete event
6 Dec 20242 minutes to read
In Syncfusion® PDF Viewer, pageRenderInitiate
and pageRenderComplete
actions are events that occur during the rendering process of PDF documents.
pageRenderInitiate
The pageRenderInitiate
event is triggered when the rendering of a page in the PDF document begins. This event provides developers with an opportunity to perform any necessary initialization or setup before the rendering of the page content commences. It can be utilized to prepare resources, set up rendering parameters, or execute any other actions required before the page rendering process starts.
pageRenderComplete
The pageRenderComplete
event is triggered when the rendering of a page in the PDF document is completed. This event allows developers to perform cleanup tasks or finalize rendering-related processes after the rendering of the page content finishes. It can be used to release resources, finalize rendering settings, or handle any post-rendering tasks necessary for the application.
@{
ViewBag.Title = "Home Page";
}
<div style="width:100%;height:600px">
@Html.EJS().PdfViewer("pdfviewer").DocumentPath("https://cdn.syncfusion.com/content/pdf/hive-succinctly.pdf").PageRenderInitiate("pageRenderInitiate").PageRenderComplete("pageRenderComplete").Render()
</div>
<script>
function pageRenderInitiate(args) {
// This method is called when the page rendering starts
console.log('Rendering of pages started');
console.log(args);
};
function pageRenderComplete(args) {
// This method is called when the page rendering completes
console.log('Rendering of pages completed');
console.log(args);
};
</script>
@{
ViewBag.Title = "Home Page";
}
<div style="width:100%;height:600px">
@Html.EJS().PdfViewer("pdfviewer").ServiceUrl(VirtualPathUtility.ToAbsolute("~/api/PdfViewer/")).DocumentPath("https://cdn.syncfusion.com/content/pdf/hive-succinctly.pdf").PageRenderInitiate("pageRenderInitiate").PageRenderComplete("pageRenderComplete").Render()
</div>
<script>
function pageRenderInitiate(args) {
// This method is called when the page rendering starts
console.log('Rendering of pages started');
console.log(args);
};
function pageRenderComplete(args) {
// This method is called when the page rendering completes
console.log('Rendering of pages completed');
console.log(args);
};
</script>
The provided code demonstrates how to subscribe to the pageRenderInitiate
and pageRenderComplete
events in the Syncfusion® PDF Viewer component.