198

I have a two-page SSRS report. When I exported it to PDF it was taking 4 pages due to its width, where the 2nd and 4th pages were displaying one of my fields from the table. I tried to set the layout size in report properties as width=18in and height =8.5in.

It gave me the whole table in a single page of PDF, but I am still getting the 2nd and 4th pages blank.

Is the way I am doing it incorrect? How else can I get rid of those blank pages?

Mark Hions
  • 19
  • 6

14 Answers14

350

In BIDS or SSDT-BI, do the following:

  1. Click on Report > Report Properties > Layout tab (Page Setup tab in SSDT-BI)
  2. Make a note of the values for Page width, Left margin, Right margin
  3. Close and go back to the design surface
  4. In the Properties window, select Body
  5. Click the + symbol to expand the Size node
  6. Make a note of the value for Width

To render in PDF correctly Body Width + Left margin + Right margin must be less than or equal to Page width. When you see blank pages being rendered it is almost always because the body width plus margins is greater than the page width.

Remember: (Body Width + Left margin + Right margin) <= (Page width)

Nathan Griffiths
  • 10,729
  • 2
  • 27
  • 45
  • 14
    Doesn't work. My body width is less than "Report width - margins". And still I have a ton of blank pages in there. – adolf garlic Apr 12 '10 at 08:06
  • Then the problem is likely to be elsewhere in your report - check the Page Break settings on all your report items. – Nathan Griffiths Jun 24 '10 at 00:09
  • How bizarre, I find myself facing the same issue again and again this solution doesn't help. :( – adolf garlic Jul 05 '11 at 08:11
  • 3
    @adolfgarlic I've found that the page width settings don't always work correctly under report properties. Have you tried manually dragging the report width in Visual Studio? That resolved this issue for me today after banging my head against the wall for a good while. Would be worth checking your header / footer widths also, they might be slightly too large. – Michael A Jan 11 '12 at 05:40
  • 16
    I found that the rule that worked here was not (Body Width + Left margin + Right margin) <= (Page width) but more like (Body Width + Left margin + Right margin) < (Page width-1cm) – Jafin Mar 14 '12 at 00:57
  • @adolfgarlic see my additional answer below for two other instances I've encountered – Joshua Drake Apr 10 '12 at 21:14
  • +1 "When you see blank pages being rendered it is almost always because the body width plus margins is greater than the page width." is something that should be shown in the BIDS splash screen :-) – Nathan Jul 18 '12 at 09:55
  • I can't even set the width of my report, it's stuck at some seemingly arbitrary number like "8.340239in". There's no rhyme or reason to it. – Ben Lesh Sep 11 '12 at 19:33
  • Thanks man! It makes complete sense but within an already messy report, sense is something with stop looking for.. :) – AlexCode Feb 19 '13 at 16:07
  • You're a legend. Was not looking forward to hours of tweaking to try and get rid of the page breaks. Followed your steps and worked first time. Note that I had a header and detail report, detail was fine, header was too wide. – Craig B Mar 19 '13 at 21:04
  • Thanks Nathan, I was able to reduce page count to 2 from 4 , Only 1st page contains data, other one is blank. what can i do for it? – t4thilina May 14 '14 at 05:33
  • 3
    Also another thing to note is the height of the header + body + footer + top + bottom margin < Page Height else the page is going to flow in multiple pages. – desiguy Sep 09 '14 at 13:53
  • 4
    When you create a report for the first time, the builder runs a white area (the "Body" that Nathan mentions) across the width of the screen to put stuff on. Typically, this white area is 17 inches wide on a newer letterbox screen. What isn't intuitively obvious is that this is considered a printable object, and needs to be narrowed to the width of the stuff you put on it. If you don't do this, you'll get blank pages, no matter all the other stuff that everyone mentions. – BobRodes Dec 30 '14 at 15:07
  • It worked for me when I changed page size > body size – Ravi Shankar Jan 29 '15 at 05:46
  • That will be because page size includes the body AND margins, so you probably increased the page size to a value that was at least as big as body + margins – Nathan Griffiths Feb 04 '15 at 00:12
116

Another thing to try is to set the report property called ConsumeContainerWhitespace to True (the default is false). That's how it got resolved for me.

ΩmegaMan
  • 22,885
  • 8
  • 76
  • 94
Chrysalis
  • 3,950
  • 2
  • 16
  • 23
  • 2
    Yep, worked for me too. I have a container with a tablix with column groups. Clearly the container was growing to contain the column groups and without consuming the container's white space it would overflow the page boundary. – Ciarán Jan 21 '14 at 14:36
  • 4
    This was certainly the key for me. I always utilize the accepted answer by Nathan, with mixed results. In each case where Nathan's solution did not solve the problem, this one did the trick. Be aware that you still should utilize what Nathan suggests. – bojingo Feb 21 '14 at 13:58
  • YES x100! It's too bad you can't have 2 "accepted answers", because it seems like the proper course is a combo of both this and the accepted one. Kudos to you! – NateJ Aug 31 '16 at 18:55
  • I am using VS 2017 SSRS, do not see this property. – codeMonkey Apr 18 '17 at 17:07
  • 2
    Whoops, take it back. I am using VS 2017 SSRS/SSDT; took me a while to figure out you have to use Properties _window_ to find this feature, _not_ the `Report Properties...` dialog. – codeMonkey Apr 18 '17 at 17:15
  • 1
    that worked for me after struggling for a while... thanks so much – Joel_J Apr 18 '19 at 16:48
28

After hours of struggling with this problem, I stumbled upon a solution that worked for me:

In SSDT (2012), I had originally had my Page Setup/Page units set to Centimeters. When I changed this to Inches, strangely enough, I was able to export my report to PDF without having every other page be blank.

enter image description here

sion_corn
  • 2,845
  • 8
  • 33
  • 58
  • This worked for me perfectly. Changing inches to Cm will work or vice versa, but there is no need to stick on the Cm. One more thing is, need to set margins for at-least 1cm then the report is generating without additional empty page. – Ravi Shankar Feb 19 '17 at 07:24
23

It is better to do this on the design surface (Visual Studio 2012 is shown but can be done in other versions) first before calculating any maths when editing an SSRS document.

Below the following numbers in red circles that map to these following steps:

  1. In the design surface, sometimes the editor will create a page which is larger than the actual controls; hence the ghost area being printed.
  2. Resize to the controls. Visually look at the width/height and see if you can't bring in the page on the design surface to size it to the space actually needed by the controls and no more.
  3. Then try to create a PDF and see if that fixes it.
  4. If #3 does not resolve the issue, then there are controls requiring too much of the actual page size and going over in either length/width. So one will need to make the size of the controls smaller to accommodate a smaller page size.

Steps to manually remediate


Also in some circumstances one can just change a property of the report page by setting ConsumeContainerWhitespace to true to automatically consume the spaces.

ΩmegaMan
  • 22,885
  • 8
  • 76
  • 94
  • 2
    Thankyou! I knew it had to be simpler than going through numbers and doing math. I wasn't aware that it was printing whitepace just because the report body was that large. – Tor Apr 15 '15 at 13:52
  • Setting ConsumeContainerWhitespace to true did it for me. I had already cleaned up my report, body, and table widths though – Jon Dosmann Aug 16 '17 at 17:29
21

The problem for me was that SSRS purposely treats your white space as if you intend it be honored:

enter image description here

As well as white space, make sure there is no right margin.

Jeremy Thompson
  • 52,213
  • 20
  • 153
  • 256
17

If the pages are blank coming from SSRS, you need to tweak your report layout. This will be far more efficient than running the output through and post process to repair the side effects of a layout problem.

SSRS is very finicky when it comes to pushing the boundaries of the margins. It is easy to accidentally widen/lengthen the report just by adjusting text box or other control on the report. Check the width and height property of the report surface carefully and squeeze them as much as possible. Watch out for large headers and footers.

HectorMac
  • 5,811
  • 4
  • 21
  • 23
6

I have worked with SSRS for over 10 years and the answers above are the go to answers. BUT. If nothing works, and you are completely stuffed....remove items from the report until the problem goes away. Once you have identified which row or report item is causing the problem, put it inside a rectangle container. That's it. Has helped us many many times! Extra pages are mostly caused by report items flowing over the right margin. When all else fails, putting things inside a rectangle or an empty rectangle to the right of an item, can stop this from happening. Good luck out there!

LucasF
  • 121
  • 2
  • 8
  • Its worked for me.by adding extra empty column into table, my report in pdf format doesn't show the extra blank pages..! – firefly Jun 20 '16 at 11:45
5

In addition to the margins, the most common issue by far, I have also seen two additional possibilities:

  1. Using + to concatenate text. You should use & instead.
  2. Text overflowing the width of the specified textbox. So if your textbox only holds 30 characters and you try to cram 300 in there, you might end up with extra pages.
Joshua Drake
  • 2,581
  • 2
  • 34
  • 53
4

Have you tried to see if there is any white space on the right of your report? If so you can drag it back to the end of your report and then drag the report background back to the same spot.

4

On the properties tab of the report (myReport.rdlc), change the "Keep Together" attribute to False. I've been struggling with this issue for a while and this seems to have solved my issue. enter image description here

Omar
  • 111
  • 2
  • 12
3

I recently inherited a report that I needed to make a few changes. After following all the recommendations above, it did not help. The report historically had this extra page, and nobody could figure out why.

I right clicked on the tablix and selected properties. There was a checkbox checked that said add a page break after. After removing this, it prints on one page now.

enter image description here

crh225
  • 692
  • 17
  • 32
2

If your report includes a subreport, the width of the subreport could push the boundaries of the body if subreport and hierarchy are allowed to grow. I had a similar problem arise with a subreport that could be placed in a cell (spanning 2 columns). It looked like the span could contain it in the designer and it rendered fine in a winform or a browser and, originally, it could generate printer output (or pdf file) without spilling over onto excess pages.
Then, after changing some other column widths (and without exceeding the body width plus margins), the winform and browser renderings looked still looked fine but when the output (printer or pdf) was generated, it grew past the margins and wrote the right side of each page as a 2nd (4th, etc.) page. I could eliminate my problem by increasing colspan where the subreport was placed.
Whether or not you're using subreports, if you have page spillover and your body design fits within the margins of the page, look for something allowed to grow that pushes the width of the body out.

0

Make sure the designer in visual studio is not going beyond your max width. Hover over the right page border and drag to the left to make sure the page does not go over your desired layout.

enter image description here

maguy
  • 1,481
  • 1
  • 13
  • 26
-3

I've successfully used pdftk to remove pages I didn't want/need in pdfs. You can download the program here

You might try something like the following. Taken from here under examples

Remove 'page 13' from in1.pdf to create out1.pdf pdftk in.pdf cat 1-12 14-end output out1.pdf

or:

pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

vinc456
  • 2,730
  • 5
  • 19
  • 29