Click here to Skip to main content
15,851,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am Designing the Report Using RDLC and Viewing that Report in PDF format. Below is my code. Please help me how to add watermark in this PDF file.

ReportViewer1.ProcessingMode = ProcessingMode.Local;
LocalReport rep = ReportViewer1.LocalReport;

Warning[] warnings = null;
string[] streamids = null;
string mimeType = null;
string encoding = null;
string extension = null;
string deviceInfo =
"<deviceinfo>" +
" <outputformat>PDF" +
" <pagewidth>8.5in" +
" <pageheight>11in" +
" <margintop>0.5in" +
" <marginleft>0in" +
" <marginright>0in" +
" <marginbottom>0.5in" +
"";
byte[] bytes;

rep.ReportPath = "HR/Report/AttTrend.rdlc";
ReportDataSource dsStatus = new ReportDataSource("DataSet24_HR_Attendance_Trend_Report", "SP");


rep.DataSources.Add(dsStatus);
rep.Refresh();

bytes = rep.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);

ShowPDF(bytes);

private void ShowPDF(byte[] bytePDF)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream(bytePDF);
Response.ContentType = "Application/pdf";
Response.BinaryWrite(ms.ToArray());
Response.End();
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900