Print page

Hi team,

I have a requirement where a user needs to print the contents of the page on button click.

This page has a sfDatagrid and few Textboxes, when clicked on a button on the page all the contents of the page needs to be printed. I am aware of printing the datagrid functionality provided by Synfusion I would like to know if you have any functionality similar to printing the whole page with controls/content.


Thanks

Baba



2 Replies

BG Baba Goud Gadiga April 26, 2022 03:12 PM UTC

Hi team,

Can someone throw a suggestion on how to achieve this?


Thanks

Baba



JL Joshna Lingala Uthama Reddy Lingala Syncfusion Team May 5, 2022 08:51 AM UTC

Hi Baba,


Sorry for the delay.


We have prepared a sample to print the page with controls on button click which you can download from the below link.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PrintPage-120043566


Code Snippets:


@inject IJSRuntime Js

 

<SfButton OnClick="PrintFunc">Print</SfButton>

 

@code{

 

    private async Task PrintFunc()

    {

        await Js.InvokeVoidAsync("printPage");

    }

}

 

Custom.js

 

function printPage() {

    window.print();

}


Kindly try with the sample and get back to us if you have any queries.


Regards,

Joshna L


Loader.
Up arrow icon