Introduction
In my previous article I described how to create a RDLC report.
Now I show how to save a RDLC report as a PDF at run time.
I am creating a method for that named "SAVEPDF" with the two arguments:
- Path (Location) as string type where we want to save that PDF file.
Example: C:\MyFile\
- Another is ReportViewer that is the instance of the ReportViewer Class
On which we will perform the action to convert the report to a PDF; but not just PDF, we can save the file in another format, such as Word or Excel.
Here is the sample code:
- public void SavePDF(ReportViewer viewer, string savePath)
- {
- byte[] Bytes = viewer.LocalReport.Render(format:"PDF",deviceInfo:"");
- using (FileStream stream = new FileStream(savePath, FileMode.Create))
- {
- stream.Write(Bytes, 0, Bytes.Length);
- }
- }
We can save the RDLC report in another format like Word or Excel; not just in PDF.


Larry RousePosted Jul 7, 2019, 3:26 AM EDT
This is brilliant! Works like a charm and solved a major problem for me. Thanks
Luai MaanePosted Nov 27, 2018, 2:40 AM EST
Dear can i print the rendering PDF direct without saving on drive ,if yes please the code .
Daniel PickerPosted Feb 7, 2018, 3:22 AM EST
Hello ck! I have this issue : An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dllAccess to the path'D:\Aqueduc\RapportsAqueduc' is denied. You have an idea?
stylesmylez smylezPosted Jan 24, 2018, 2:38 PM EST
This is awsome!!!!!!!!!!!!!!!!!!
Jyoti JodhaPosted Jun 20, 2017, 3:28 AM EDT
Hello Sir,Can we set font color , Back color, Left Margin,Right Margin,Top Margin,Bottom margin,Logo etc to ssrs local report from c#
karthi pmPosted Mar 27, 2015, 5:59 AM EDT
this is not working waste of time
shiju kvPosted Jan 7, 2015, 6:21 PM EST
it shows an exception the sourse is not defined.what is the device info
Freddy CorleonPosted Nov 21, 2014, 7:14 AM EST
How to save as Word and call from page load?