Print or download page to PDF with colors using JavaScript in ASP.Net

Last Reply 2 months ago By dharmendr

Posted 2 months ago

Sir,

I have page abc.aspx, which is loading properly with all color whatever I have defined.

When clicking for print in .pdf printer the all colors gone, I need to print that with colors

Please guide, or download in pdf file in local/client machine 

Please guide

Posted 2 months ago

Posted 2 months ago

Sir, the page is not showing error on load

I have change the following line instead of clientid "ID"

 var panel = document.getElementById("<%=pnlContents.ID%>");

rest are as sugested.

please help


Posted 2 months ago
Mehram says:
var panel = document.getElementById("<%=pnlContents.ID%>");

 You have to use ClientID instead of ID.

var panel = document.getElementById("<%=pnlContents.ClientID%>");

Refer below article for more details.

ASP.Net: JavaScript document.getElementById returns NULL when using Master Page