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

sql server reporting services

group:

HOWTO: Get page count when rendering PDF



Re: HOWTO: Get page count when rendering PDF DrunkenSmurf
3/31/2005 1:45:24 PM
sql server reporting services: [quoted text, click to view]


"In Version 1 of Reporting Services, there is not a SOAP API available
to
discover how many pages are in the report. We looking at adding this
type of
support for future versions. One workaround, albeit not so hot, is to
render
the entire report and then count the <HR> tags in the report html
source.
This will tell you how many page breaks are in the report. From there,
you
should be able to calculate pages. This requires that you render the
entire
report behind the scenes before displaying any pages. So it is only
practical for smaller reports. "
HOWTO: Get page count when rendering PDF Chris Walls
3/31/2005 2:52:15 PM
We have a Windows application that renders reports via the MS Reporting
Services web service. We are rendering these reports in PDF. As we
retrieve the reports we save them to the local disk. Before retrieving the
next report, we need to know how many pages were rendered in the current
report.

We are currently rendering the report as

result = _RS.Render("MyReportName","PDF",null,null,parameters,null,null,out
encoding,out mimetype,out parametersUsed,out warnings,out streamids);

In this case, the streamids is empty (i.e. streamids.Length == 0). It seems
that the only way to get a populated streamid array is to render the reporty
specifying a format of IMAGE (at least this is the only format illustrated
in the page count examples we've found).

result = _RS.Render("MyReportName","IMAGE",null,"
<DeviceInfo><OutputFormat>EMF</OutputFormat></DeviceInfo>",
parameters,null,null,out encoding,out mimetype,out parametersUsed,out
warnings,out streamids);

We've tried

result = _RS.Render("MyReportName","PDF",null,"
<DeviceInfo><OutputFormat>EMF</OutputFormat></DeviceInfo>",
parameters,null,null,out encoding,out mimetype,out parametersUsed,out
warnings,out streamids);

but, once again, the streamids.Length == 0.


1) Is there a way to determine the number of pages a report has when we
render it PDF?

2) If we have to make the second call specifying an IMAGE format, does this
execute the entire report again? Though I suspect so, I am hoping that
perhaps the report is somehow cached for some length of time.


Thanks,
Chris

Re: HOWTO: Get page count when rendering PDF Chris Walls
4/1/2005 7:54:02 AM
Yes, I saw this, but I also found MSDN articles that describe how to use the
count of steamids to determine the number of pages
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_intro_7vqa.asp).

Obviously this is a work-around and therefore I believe my first question is
still valid. Is there a way to apply this work-around by rendering the
report in PDF?


[quoted text, click to view]

AddThis Social Bookmark Button