Alex Rivera | Logout

How to limit RDLC report for one page in a PDF ?

Asked 2009-01-09T11:19:54.217
31

I have a RDLC report and I am displaying it on the Report Viewer Control in my front end application. I am able to view the report perfectly.

But the problem arises when I try to export the report to a PDF (using the built-in option).

I print the report in 3 pages whereas my client wants it to be in a single page. I can't figure out the reason for it as in my report viewer I see only one page but in a PDF there are 3 pages.

Can something be done about it so that I can control the size of the report?

Edit
Report

3 Answers

81

The answer is pretty similar to what Dugan said, but it's not always just the margins. It is pretty simple though:

When you are editing the rdlc file in design mode, firstly click on an empty part of the BODY area of your design. Hit F4 to see the properties tab. Here, you will see a "Size" property. This can be expanded for the width and height. The width you see here represents the width that the body of your report requires as printable area. Even if you have white space all over, the page knows that it needs to keep it as a printable area. It reserves the space, in some sense. As for the height, the system generally knows that it can grow or shrink as necessary, unless you have specified otherwise within your controls therein. So the width is what will, usually, play the most important role.

Next, click on an empty area of the report (outside the header, body, and footer; basically the gray area around the design), then hit F4 to view the properties panel. Under the "Layout" category of the properties, you will see 3 different options: InteractiveSize, Margins, PageSize. Each of those Size attributes can be expanded to show the Width and Height. The Margins attribute can be expanded for the left/right/top/bottom.

Basically, the pdf export works out of the PageSize (though I generally try to keep Interactive and Page size equal). When the pdf file is rendered via the ReportViewer's built-in export function, the width and height of each "page" within the pdf will be determined by the width and height in the report's PageSize attribute (you could override this if you used your own custom code for the pdf rendering). As for the margins, they specify how much space MUST be left blank and unprintable between the printable area reserved for your report and the edge of the page.

In other words: Your report's Body's Width, Plus the Report's Left Margin, Plus the Report's Right Margin, MUST be smaller than or equal to the R

answered 2009-06-25T20:02:20.897
8

Always maintain body width : 7.5 or less

Left, Right Margin width less than 0.5 Set the Margin width first -> goto main menu Reports->Report Properties->Layout->change left margin and right margin

Total page width :8.5

Ramana

answered 2009-08-20T09:14:01.860
5

In addtion to watching your widths, I found other unrelated things that can cause extra blank page in the PDF.

If the tablix has any field with word wrap, this can cause it. You might want to make the font smaller if you have long data. Make the font size property equal to something like this:

  =iif(len(Fields!RepGroupName.Value) > 25, "6pt","8pt")

Another thing you may have to do. And this helped me when I had no apparent reason for the extra page. In the Report property page, set: ConsumeContainerWhitespace = true

Yet another thing to watch for. The body size can grow without you knowing it while making changes to the layout. You might have to knock it back down again.

This issue is highly annoying for the end user if not resolved and annoying as heck for us to resolve.

answered 2011-10-13T05:44:59.063

Your Answer