Reputation: 20684
in asp.net, after creating a reportDocument, I would like to save it as a pdf report without showing it. In other words, I would like to show a response that the user chooses to save it:
ReportDocument reportdoc = new ReportDocument();
reportdoc.Load(Server.MapPath("CrystalReporttest.rpt"));
reportdoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "test123.pdf");
So far, I have tried it like this and it shows the pdf report rather than ask for "save it".
It is a directly way to do so in asp.net?
Thanks in advance.
Upvotes: 0
Views: 529
Reputation: 20684
I found the answer,
it is like this:
reportdoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "test123.pdf");
Stupid me!
Upvotes: 0
Reputation: 1208
You need to store the converted PDF in memory or on the file system and transmit the file like a regular file download using TransmitFile.
Upvotes: 0