Hi all,
We have developed a application in angular and asp.net web API.
I am developing an API in c#.net. Third party user will send request to/ hit this API with some input parameters and depending on those parameters I have to send a pdf file as a response. How can I send a PDF file as a response. I am using crystal report for reporting.
I have to convert this report to a PDF file and send as response.
Currently I am sending base64 string to angular/ client side code when this API is hit by our client. But when a third party user will send request then we have to send respnose in PDF.
cryRpt.Load("C:/Report/testreport.rpt");
cryRpt.SetDataSource(dt); // dt is a data table
cryRpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "C:/Report/testreport.pdf");
byte[] bytes = File.ReadAllBytes("C:/Report/testreport.pdf");
result = Convert.ToBase64String(bytes);
cryRpt.Close();
cryRpt.Dispose();
File.Delete("C:/Report/testreport.pdf");
return result;
How can I send PDF file in reponse?
Thank you in advance.