RadPdfViewer for ASP.NET AJAX is based on the Kendo UI PdfViewer Widget. Thus, it exposes the Client-side API and methods offered by the widget and mainly provides a wrapper and API for working with the PdfViewer on the server.
You can get Client-side Object Reference to the PdfViewer control in order to use its API like this:
var
RadPdfViewerObject = $find(
"<%=RadPdfViewer1.ClientID %>"
);
The most commonly used RadPdfViewer client-side methods are:
-
execute—Executes a command of the PDFViewer.
-
fromFile—Displays the file which path is passed as a parameter in the PDFViewer.
-
get_activePage—Returns the selected page number in the viewer.
-
get_pages—Returns a list of the pages in the loaded document.
-
set_activePage—Loads and scrolls to the page by number.
You can find the full client-side API of the control in the RadPdfViewer Client-side API documentation article.
Get Client-side Object Reference to the Kendo PdfViewer widget in order to use its API
There are two ways to get a reference to the Kendo PdfViewer widget in order to use its API:
-
Use the get_kendoWidget method the RadPdfViewer client-side object exposes. You can get the RadPdfViewer object through the $find() MS AJAX method:
var
RadPdfViewerObject = $find(
"<%=RadPdfViewer1.ClientID %>"
);
//the standard script control object
var
kendoPdfViewerObject = RadPdfViewerObject.get_kendoWidget();
//the Kendo widget
-
Use the standard Kendo approach for getting the widget through the data-attributes of the DOM element:
var
kendoPdfViewerObject = $telerik.$(
"#<%=RadPdfViewer1.ClientID %>"
).data(
"kendoPDFViewer"
);
//the jQuery selector must get the RadPdfViewer1 select element