Last post Aug 01, 2017 04:27 AM by Billy Liu
Jul 28, 2017 06:11 PM|RaviBorra|LINK
Can some one help me in which encoding does Microsoft.Reporting.WebForms.LocalReport.Render uses to generate pdf file? on what basis it uses particular encoding technique?
Because in one of our environment the unicode characters are rendering properly and in other environment it renders question marks for unicode characters with the same code.
Aug 01, 2017 04:27 AM|Billy Liu|LINK
You need to create a rdlc file to export pdf.
You could refer to link below for a tutorial of create rdlc file:
And then use render to generate pdf file.
protected void Button1_Click(object sender, EventArgs e)
DataTable dt = new DataTable();
dt.Rows.Add("CustomerID1", "City1", "Country1");
dt.Rows.Add("CustomerID2", "City2", "Country2");
dt.Rows.Add("CustomerID3", "City3", "Country3");
Microsoft.Reporting.WebForms.LocalReport lr =
string deviceInfo =
lr.DataSources.Add(new ReportDataSource("DataSet1", dt));
byte bytes = lr.Render("PDF", deviceInfo, out mimeType,
out encoding, out filenameExtension, out streamids, out warnings);
using (FileStream fs = new FileStream(Server.MapPath("Report1.pdf"), FileMode.Create))
fs.Write(bytes, 0, bytes.Length);
And the result is:
You could refer to the following link for more information:
Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information
found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft
cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.