Articles in this section
Category / Section

How to open pdf document on button click inside a Grid?

2 mins read

You can open a pdf document in a modal dialog on button click which is placed inside the grid. This can be achieved by using the Grid, Dialog, and PdfViewer components.

First, the Dialog and PdfViewer components will be initialized. The PdfViewer element will be rendered inside the Dialog element and its visibility is set as false.

<div id="dialog">

    <div id="pdfViewer"></div>



let dialogObj: Dialog = new Dialog({

        header: "Details",

        showCloseIcon: true,

        isModal: true,

        visible: false




let viewer: PdfViewer = new PdfViewer({



        documentPath: "document"



viewer.load("PDF_Succinctly.pdf", null);


Then, a button will be rendered inside the Grid column with click event bound to it. On button click, the modal dialog will be displayed which contains the pdf document.

    function onClick() {
        var dialogObj = document.getElementById("dialog").ej2_instances[0];;


Pdf in modal dialog

You can find the samples here:

TypeScript sample

JavaScript (ES5) sample

Angular sample



I hope you enjoyed learning about how to open pdf document on button click inside a JavaScript Grid.

You can refer to our JavaScript Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
You can also explore our 
JavaScript Grid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied