Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys

I am using microsoft report viewer on windows environment with *.rdlc reporting file.

I have a requirement to programatically export the report (invoice) into PDF and save it under a folder for later use (going to email the invoices).


The reporting part is fine and all working but However, I am unable to find a way to export the report programatically....done google without much luck.


any help would be highly appreicated as am slightly running out of time.
Posted
Comments
OriginalGriff 14-Feb-14 7:00am    
Off topic:
Please stop editing spam.
This was an edict from On High: Chris tries out automated spam detection systems from time to time, and if you edit them then subsequent spam reports get attached to the edited version which contains no spammy material - this confuses the detectors and makes them useless.
Editing a question also resets its "Spam" count, which makes it last longer, and can mean that your account gets identified as the spammer if people aren't paying attention!

Just report it via the Red Flag (if you can see it) and / or post links in the Spam and Abuse forum:
http://www.codeproject.com/Forums/1652005/Spam-and-Abuse-Watch.aspx
And one the Protectors or Staff will delete it.
Bala Selvanayagam 14-Feb-14 7:03am    
Thanks & I did not know

Google is your friend: http://forums.asp.net/t/1556522.aspx/1[^]
 
Share this answer
 
Comments
Bala Selvanayagam 27-Dec-12 11:42am    
Looks this is for web based and am looking for windows.

I have already tried this without much sucess
Adam R Harris 27-Dec-12 11:53am    
wow, could have done without the attitude. I am taking time out of my day to try and assist you, grateful is the only emotion you should attempt to convey. You did not mention that this was a windows application in your question so i had to take my best guess.

byte[] buffer;
using (FileStream fs = new FileStream("[Desired File Path]", System.IO.FileMode.Append){
buffer = ReportViewer.ServerReport.Render("pdf", null, null, null, null, null, null);
fs.write(buffer, 0, buffer.length);
fs.close();
}
Bala Selvanayagam 27-Dec-12 12:28pm    
Thanks Adam,

Apologies, if i have upset you in any means. I was struggling on this for last 4-5 hours without luck and hence my comment would have been short.

I have tried your suggestion and the method ServerReport.Render() does not accept null as the out put paramters,

would be thankful, if you could dig into for me
Adam R Harris 27-Dec-12 12:41pm    
Take a look at the example on here: http://msdn.microsoft.com/en-us/library/ms252214(v=vs.80).aspx
Bala Selvanayagam 27-Dec-12 14:46pm    
Thanks, was not straight forward for the window based environment.

I have switched to crystal report which is relatively easier to export taking the time constraint into account - this resolves the issue for the time being
 
Share this answer
 
Comments
Bala Selvanayagam 27-Dec-12 15:29pm    
Thanks ridoy and will have a look
For writing of PDF, you can use iText, more exactly, its .NET port called iTextSharp:
http://en.wikipedia.org/wiki/IText[^],
http://itextpdf.com/[^],
http://sourceforge.net/projects/itextsharp/[^].

I provided links to iText, too, because nearly all documentation you need to work with iTextSharp is there, provided as Java documentation.

—SA
 
Share this answer
 
Comments
Bala Selvanayagam 28-Dec-12 3:54am    
Thanks - SA

very much useful, thanks again
Sergey Alexandrovich Kryukov 28-Dec-12 4:24am    
You are welcome. If so, please accept the answer formally (green button) — thanks.
—SA

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