all groups > sql server reporting services > august 2005 >
You're in the

sql server reporting services

group:

Automated Printing - IMAGE is bandwith hog and slow - Is there a better way?


Automated Printing - IMAGE is bandwith hog and slow - Is there a better way? CapitalEMR
8/15/2005 6:44:53 PM
sql server reporting services:
I've written an app that automatically prints reports but it takes forever
to render and then dump to the print spooler. The code I'm using came as a
sample with RS. I was dinking around with the "format" parameter to no
avail (using PDF - etc.)

This is something I think should take a couple seconds to dump to the
printer and it's taking 5 to 10 minutes.

Any help is greatly appreciated.

Thanks,

David

Parameter sample below:
public byte[][] RenderReport(string reportPath, int Encounter)

{

// Private variables for rendering

string deviceInfo = null;

string format = "IMAGE";

Byte[] firstPage = null;

string encoding;

string mimeType;

Warning[] warnings = null;

ParameterValue[] reportHistoryParameters = null;

string[] streamIDs = null;

Byte[][] pages = null;

ParameterValue[] parameters = new ParameterValue[1];

parameters[0] = new ParameterValue();

parameters[0].Name = "EncounterID";

parameters[0].Value = Encounter.ToString();

RE: Automated Printing - IMAGE is bandwith hog and slow - Is there a b djbaldwin
8/16/2005 1:53:06 AM
[quoted text, click to view]

Does the report work the same or differently from a direct url?

http://server/reports/Pages/Report.aspx?ItemPath=/ReportFolder/Report1
http://server/reportserver/?/ReportFolder/Report1&rs:Command=Render

I found the same code to be very quick and was a little surprised when I
generated mutiple pages within seconds - At first I thought it was broken!

The only other suggestion I have is to look for something failing (such as
invalid credentials) where something is blocked on a timeout. If I recall
there was at least one mistake with the error handling (page count in
finally?)

If you are not getting any errors, try pausing the printer driver and
watching the queue. It should show you the spooling has started and the size
of the file.

No easy answer, just some thoughts.



Re: Automated Printing - IMAGE is bandwith hog and slow - Is there a b CapitalEMR
8/16/2005 2:24:18 PM
That's very exciting. I would love a fix for this. I'm not sure how I
would render that.... I'm using the code from the sample that came with RS
(FileRenderSave) for the printing routine.

Can you give me some direction or a code snippet on this?

Thanks,

David

[quoted text, click to view]

Re: Automated Printing - IMAGE is bandwith hog and slow - Is there a b CapitalEMR
8/16/2005 3:06:24 PM
If you're inclined to look at it - a good URL explaining the code I'm using
is at:
http://blogs.msdn.com/bryanke/articles/71491.aspx#code




[quoted text, click to view]

Re: Automated Printing - IMAGE is bandwith hog and slow - Is there a b Dwayne J. Baldwin
8/18/2005 3:23:04 PM
[quoted text, click to view]

That's the exact code that I'm using, except I ported it to vb.net. If I
recall, there were two issues that I needed to fix,

In ReportDrawPage width and height were never used...

// Set the metafile delegate.
int width = m_metafile.Width;
int height= m_metafile.Height;
m_delegate = new Graphics.EnumerateMetafileProc(MetafileCallback);
// Draw in the rectangle
Point destPoint = new Point(0, 0);
g.EnumerateMetafile(m_metafile,destPoint , m_delegate);

So I changed it to this to properly size the rendered image...

Rectangle destPoint = new Rectangle(0,0,m_metafile.Width,
m_metafile.Height)

And commented out a simple flaw in the errort trap in RenderReport

finally
{
// Console.WriteLine("Number of pages: {0}", pages.Length);

Just comment out the console message. If an error occurs before 'pages' is
set, a new exception is thrown on pages.Length. It just needs some work.

Otherwise, the code works fine when you provide the proper credentials and
report info. Keep in mind that the first access will always have a
performance hit until asp.net compiles the report server, then a minor hit
as the credentials are passed.

After that it simply smokes.

You really need to profile your app to see what is happening.

Let me know if you need anything more.

Re: Automated Printing - IMAGE is bandwith hog and slow - Is there a b CapitalEMR
8/19/2005 5:10:56 PM
Ok. Thanks... I did what you mentioned too concerning the page height and
width.

I agree that it "smokes" if I'm on a 100k bandwith. The problem is that the
images this service creates are 1600k big and I'm pushing it through a 6k
pipe (Our network is between three locations and it's just sucking the life
out of the network.)

What would be great is if I could do the rendering locally. Something like
binding to the printer activex control MS just released with RS sp2. If
you're interested - I'll post back with any results on this.

Thanks a bunch for your input.

David


[quoted text, click to view]

AddThis Social Bookmark Button