Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to export rdlc report to PDF without using ReportViewer

How to export rdlc report to PDF without using ReportViewer

Scheduled Pinned Locked Moved ASP.NET
data-structureshelptutorialquestionworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    uspatel
    wrote on last edited by
    #1

    is it possible to export report directly into pdf file?

    try
    {
    stmtDataSetTableAdapters.IOB_StmtTableAdapter ds = new stmtDataSetTableAdapters.IOB_StmtTableAdapter();
    // Create Report DataSource
    ReportDataSource rds = new ReportDataSource("IOB_Stmt");

            // Variables    
            Warning\[\] warnings;
            string\[\] streamIds;
            string mimeType = string.Empty;
            string encoding = string.Empty;
            string extension = string.Empty;
    
            // Setup the report viewer object and get the array of bytes    
            ReportViewer viewer = new ReportViewer();
            viewer.ProcessingMode = ProcessingMode.Remote;
            viewer.LocalReport.ReportPath = "~/Report.rdlc";
            viewer.LocalReport.DataSources.Add(rds); // Add datasource here 
    
           ** byte\[\] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);**//Error Occured
    
            // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.    
            Response.Buffer = true;
            Response.Clear();
            Response.ContentType = mimeType;
            Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
            Response.BinaryWrite(bytes); // create the file    
            Response.Flush(); // send it to the client to download 
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    

    error on bold line An error occurred during local report processing. Please give the solution. thanks

    P 1 Reply Last reply
    0
    • U uspatel

      is it possible to export report directly into pdf file?

      try
      {
      stmtDataSetTableAdapters.IOB_StmtTableAdapter ds = new stmtDataSetTableAdapters.IOB_StmtTableAdapter();
      // Create Report DataSource
      ReportDataSource rds = new ReportDataSource("IOB_Stmt");

              // Variables    
              Warning\[\] warnings;
              string\[\] streamIds;
              string mimeType = string.Empty;
              string encoding = string.Empty;
              string extension = string.Empty;
      
              // Setup the report viewer object and get the array of bytes    
              ReportViewer viewer = new ReportViewer();
              viewer.ProcessingMode = ProcessingMode.Remote;
              viewer.LocalReport.ReportPath = "~/Report.rdlc";
              viewer.LocalReport.DataSources.Add(rds); // Add datasource here 
      
             ** byte\[\] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);**//Error Occured
      
              // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.    
              Response.Buffer = true;
              Response.Clear();
              Response.ContentType = mimeType;
              Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension);
              Response.BinaryWrite(bytes); // create the file    
              Response.Flush(); // send it to the client to download 
          }
          catch (Exception ex)
          {
              Response.Write(ex.ToString());
          }
      

      error on bold line An error occurred during local report processing. Please give the solution. thanks

      P Offline
      P Offline
      purnananda behera
      wrote on last edited by
      #2

      Yes, It is possible to export report directly into pdf file.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups