Search results

Print in ASP.NET MVC PDF Viewer control

28 Jul 2021 / 1 minute to read

The PDF Viewer supports printing the loaded PDF file. You can enable/disable the print using the following code snippet.

Copied to clipboard
    <div style="width:100%;height:600px">
        @Html.EJS().PdfViewer("pdfviewer").ServiceUrl(VirtualPathUtility.ToAbsolute("~/api/PdfViewer/")).EnablePrint(true).DocumentPath("Hive_Succinctly.pdf").Render()
    </div>

Alt text

You can invoke print action using the following code snippet.,

Copied to clipboard
<script>
    window.onload = function () {
        var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
        pdfViewer.print.print();
    }
</script>

See also