How do I save a pdf file in my local folder using c# coding? This program is running with command prompt, so I just write a code to pass parameters to my report which is in report server nw the report will send in pdf format and I want to save it in my local folder and access this file to email purpose later.
2 Answers
I'm missing a lot of info here: Is this a program that you downloaded? or is this a program you wrote yourself? Or you have yet to write it?
I'm guessing the last one. You need to write a console application that accepts parameters and then use a PDF generator tool to generate your PDF. I'm guessing you're trying to read some data in order to generate a report.

- 563
- 2
- 7
- 15
-
Ya i am not suppose to use any third party tool here,by c# coding i want to do the same.programe is wrote by myself.the parameters and other things i am passing correctly ,no issues in that case and i can generate report also in my report server with same parameters. – RnR May 12 '12 at 01:11
-
Unfortunately you cannot really create a PDF without using a third-party tool, unless you want to write your own PostScript driver (good luck with that). I suggest you use PDFCreator which adds a virtual printer. You then "print" your output to the PDF Creator printer. Link: http://sourceforge.net/projects/pdfcreator/ – mghaoui May 13 '12 at 09:56
Couldn't add this as a comment due to lack of rep so in as an answer it is.
You can save SSRS server output into PDF format directly. I'm assuming using the Report Viewer controls is out of the question for your application. So that leaves accessing the report server directly via the webservice it supplies. See the answer supplied on this question for a nice starter solution.
Reporting services: Get the PDF of a generated report
From what you described you'll need to then copy the saved PDF from the download folder into your final destination.
Hope that helps.