I'm looking for guidance or and idea to generate PDF through RDLC report without using reportviewer
. The PDF must be saved in the local specified path. I've been trying for 1 week but I'm still unable to find a solution.
Asked
Active
Viewed 1,751 times
0

Barry Michael Doyle
- 9,333
- 30
- 83
- 143

CSharpGuy
- 1
- 2
-
1solution? http://stackoverflow.com/questions/2684221/creating-a-pdf-from-a-rdlc-report-in-the-background – Ilia Maskov Apr 15 '15 at 16:22
-
Dear Agent.Realy thanks for your help. i have total 2700 student. each student i want to generate individual PDF report. first, i retrive the data from table and bind in datasource (like normal procedure to generate RDLC). after that i can run below code rite? – CSharpGuy Apr 15 '15 at 16:35
1 Answers
0
Hope this link helps RDLC to PDF
This is how you render to pdf... updated for completeness sake
private void CreatePDF(string fileName)
{
// Variables
Warning[] warnings;
string[] streamIds;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
// Setup the report viewer object and get the array of bytes
ReportViewer viewer = new ReportViewer();
viewer.ProcessingMode = ProcessingMode.Local;
viewer.LocalReport.ReportPath = "YourReportHere.rdlc";
byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
// Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
Response.Buffer = true;
Response.Clear();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
Response.BinaryWrite(bytes); // create the file
Response.Flush(); // send it to the client to download
}

Matju
- 51
- 6
-
while this link might help with the case, links often die and in that case your answer will become useless. It's always advisable to add a little detail on how the link helps – Shashank Shekhar Apr 15 '15 at 17:17
-
The earlier link already solve my issue (agent5566). anyway thanks. The link help me to Render the RDLC to convert to PDF. there rest i just folow standard code which i done earlier. – CSharpGuy Apr 15 '15 at 17:33