The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to add Print option in UI page

Deepthi25
Giga Expert

Hi team,

Please suggest me how to add print option in UI page, i have my HTMl code and I need to add button down of ui page once they click that button it should give us the windows option to print please suggest

1 ACCEPTED SOLUTION

Alok Kumar2
Tera Expert

Hi,

Can you try once with the below button in your html code. Just the below code any where and you don't need to define this function in your client script.

<button onclick="print()">Print
</button>

find_real_file.png

find_real_file.png

 

Note: Please mark this as correct or helpful if it helps!!

View solution in original post

7 REPLIES 7

prasannakumard
Tera Guru

Hi Radhi,

 

You can use the following script in UI page client script:

 

function printDiv() {
window.print();
}

 

in HTML script:

 

<button onclick="printDiv()">Print</button>

 

It'll work.

 

Thanks & Regards,

Prasanna Kumar

Hi Prasanna,

I have kept the code in my ui page, i got print button but when i click it and did not get any response. 

in similar way i tried with (onclick="window.print(); window.close();") but that is also not working!

 

Client script:

function printDiv(){
var cis = g_list.getChecked().toString();
}

HTML:

<button onclick="printDiv()">Print</button>

find_real_file.png

 

Thanks,

Radhika Chowdary B

Alok Kumar2
Tera Expert

Hi,

Can you try once with the below button in your html code. Just the below code any where and you don't need to define this function in your client script.

<button onclick="print()">Print
</button>

find_real_file.png

find_real_file.png

 

Note: Please mark this as correct or helpful if it helps!!

Worked like charm , Thanks.