Search results

Print in ASP.NET Core PDF Viewer control

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

    <div style="width:100%;height:600px">
        <ejs-pdfviewer id="pdfviewer"
                style="height:600px"
                serviceUrl="/api/PdfViewer"
                documentPath=@ViewBag.DocumentPath
                enablePrint="true">
        </ejs-pdfviewer>
    </div>

Alt text

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

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

See also