reporting services - How to export to PDF on the click of view report button of report viewer in vb.net -


can please me how can add own code report viewer button export data directly pdf.

i got below answer in 1 of thread want know how can done.

you create own custom report viewing control. control comprised of fields report parameters , button generate report. when user clicks button generate report in background. display report pdf.

to achieve you're after think you've 2 choices:

  • use report server webservice directly required output pdf file
  • use reportviewer control , render pdf it

if can use of reportviewer control easier option maintain. depending upon requirements may need mix elements of both approaches.

option 1

see answer supplied on question nice starter solution accessing web service directly

reporting services: pdf of generated report

option 2

rendering output of reportviewer control pdf involves rendering report viewer output byte array, , sending memorystream object , writing output stream. sample code below take report configured in report viewer control , generate pdf directly current web page :

warning[] warnings = null; string[] streamids = null; string mimetype = null; string encoding = null; string extension = null; byte[] bytes = null; bytes = reportviewer1.serverreport.render("pdf", null, mimetype, encoding, extension, streamids, warnings); system.io.memorystream ms = new system.io.memorystream(bytes); response.contenttype = "application/pdf"; response.binarywrite(ms.toarray()); response.end(); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -