asp.net mvc - Rdlc to PDF rendering slow -


we've been doing timing on of our slow pdf reports on our asp.net mvc3 web app,

one in particular kinda blew our mind...

sql - returned in few nundred milliseconds rdlc processing - few hundred miliseconds pdf generation - on 4 min

i've found this: http://social.msdn.microsoft.com/forums/sqlserver/en-us/ca45fcc4-be69-410f-aaed-19b65f279330/reporting-services-sp1-slow-on-pdf-render

and this: msdn page 2

explaining how address optimizing rdlc, wanted make sure wasn't doing stupid in c# code.

here section takes rdlc , renders pdf, looks pretty simple, doing in optimal way? following best practices?

    // build byte stream     answerbytes = localviewer.render(         args.reporttype, args.deviceinfoxml, out mimetype, out encoding, out fnameext,         out streamids, out warnings );      // send out vars client.     args.minetype = mimetype;     args.fnameext = fnameext;     // dispose of local viewer when complete     localviewer.dispose();      netloghdl.trace( "done pdf work " );     return answerbytes; 

pdf generation soo bad feel must have dome wrong...

p.s. here more of stack if it's needed

public byte[] bytestreampdf(ref bytestreamreportargscv args)     {         //the deviceinfo settings should changed based on reporttype                     //http://msdn2.microsoft.com/en-us/library/ms155397.aspx                     string deviceinfo = "<deviceinfo>";         deviceinfo += "<outputformat>pdf</outputformat>";          if (args.landscape)         {             deviceinfo += "<pagewidth>11in</pagewidth><pageheight>8.5in</pageheight>";         }         else         {             deviceinfo += "<pagewidth>8.5in</pagewidth><pageheight>11in</pageheight>";         }          deviceinfo += "<margintop>0.5in</margintop><marginleft>1in</marginleft>";         deviceinfo += "<marginright>1in</marginright><marginbottom>0.5in</marginbottom>";         deviceinfo += "</deviceinfo>";         deviceinfo = "";          args.deviceinfoxml = deviceinfo;         args.reporttype = "pdf";         return bytestreamreport(ref args);     }   public byte[] bytestreamreport(ref bytestreamreportargscv args)         {             warning[] warnings;             string[] streamids;             string encoding;             string fnameext;             string mimetype;             byte[] answerbytes;             localreport localviewer = new localreport();               // enable external images... cr # 20338 jk             localviewer.enableexternalimages = true;              // build report data source             // open .rdlc in notepad <datasets>  section in xml             // use find on next line.             reportdatasource rds = new reportdatasource(args.nameofdatasetinrdlc, args.datatofillreport);              // set report path , datasource             iwebaccess webaccesshdl = objectfactory.getinstance<iwebaccess>();             //next line httpcontext.current.request.mappath(args.rdlcpathandfname); changed use webaccess - ewb             localviewer.reportpath = webaccesshdl.getmappath(args.rdlcpathandfname);             localviewer.datasources.add(rds);              // add parameters rdlc needs             if (args.rptparameters != null)                 localviewer.setparameters(args.rptparameters);              //sub report task             if (args.subreportdatatofillreport != null)             {                 (int = 0; < args.subreportdatatofillreport.length; i++)                 {                     reportdatasource subrds = new reportdatasource(args.subreportnameofdatasetinrdlc[i],                                                                    args.subreportdatatofillreport[i]);                     localviewer.datasources.add(subrds);                 }                  if (args.subreportdatatofillreport.length > 0)                     localviewer.subreportprocessing +=                         loadsubreportprocessingeventhandler;             }              //end of sub report task              // build byte stream             answerbytes = localviewer.render(                 args.reporttype, args.deviceinfoxml, out mimetype, out encoding, out fnameext,                 out streamids, out warnings);              // send out vars client.             args.minetype = mimetype;             args.fnameext = fnameext;             // dispose of local viewer when complete             localviewer.dispose();             return answerbytes;         } 


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -