Skip to content

How to create report PDF using ASP.Net MVC5

malusi ngubane

Asked Jul 31, 2015, 6:16 AM EDT6 answers
Share
LinkedInX
I want to create report , so i want to know mvc code  that can allow me to be able to save information into a PDF file ,so that any one can be able to download my PDF file

6 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Manoj Bhoir
    +1
    Hi,
     
    Java
    If you are using SQL Server Reporting Service (SSRS) for Reporting then try this code :
    
    public ActionResult GetPdfReport()
        {
            NetworkCredential nwc = new NetworkCredential("username", "password");
            WebClient client = new WebClient();
            client.Credentials = nwc;
            string reportURL = "http://someIp/ReportServer/?%2fReportProjectName/ReportName&rs:Command=Render&rs:Format=PDF";
            return File(client.DownloadData(reportURL), "application/pdf");
        }
     
    +1
  • 0
    Here is another way you can do this, refer to a following article:
    This approach uses a C# component for processing Word documents, for example here is a simple sample:
    DocumentModel document = new DocumentModel();
     
    document.Sections.Add(
      new Section(document,
        new Paragraph(document, "Sample content")));
     
    document.Save("Report.pdf");
     
    Also note that you have a direct method for exporting PDF files to ASP.NET's client, like this:
    document.Save(this.Response, "Report.pdf"); 
    0
  • 0
    there is error in username password aur report url and if you anu example project kindly share with me
    0
  • 0
    there is error in username password aur report url and if you anu example project kindly share with me
    0
  • 0
    there is error in username password aur report url and if you anu example project kindly share with me
    0
  • 0
    can you share the example project??
    0