How to get rid of blank pages in PDF exported from SSRS
Asked Answered
F

17

222

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?

Failing answered 12/12, 2008 at 14:27 Comment(0)
P
391

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)

Peba answered 18/12, 2008 at 2:8 Comment(15)
Doesn't work. My body width is less than "Report width - margins". And still I have a ton of blank pages in there.Snaky
Then the problem is likely to be elsewhere in your report - check the Page Break settings on all your report items.Peba
How bizarre, I find myself facing the same issue again and again this solution doesn't help. :(Snaky
@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.Unbecoming
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)Boothe
@adolfgarlic see my additional answer below for two other instances I've encounteredTransistorize
+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 :-)Thornburg
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.Quinquennium
Thanks man! It makes complete sense but within an already messy report, sense is something with stop looking for.. :)Opsis
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.Kerch
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?Spoliate
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.Pocky
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.Kingdon
It worked for me when I changed page size > body sizePedate
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 + marginsPeba
S
134

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.

Saturation answered 17/7, 2013 at 21:57 Comment(5)
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.Lammastide
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.Mosier
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!Glaser
I am using VS 2017 SSRS, do not see this property.Gonzalo
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.Gonzalo
F
30

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

Furcate answered 5/12, 2012 at 18:14 Comment(1)
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.Pedate
I
26

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.

Irizarry answered 26/1, 2015 at 15:3 Comment(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.Underlaid
Setting ConsumeContainerWhitespace to true did it for me. I had already cleaned up my report, body, and table widths thoughTheron
I
25

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.

Incensory answered 16/6, 2015 at 3:47 Comment(3)
Hi @jeremy-thompson, your tip happens to be very handy. CheersGeryon
Removing the right margin worked for me and didn't affect rendering in either web report viewer or PDF.Dight
5 years later, this was the one for me.Pharisaism
I
20

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.

Ivanovo answered 12/12, 2008 at 16:9 Comment(0)
P
6

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.

Presley answered 16/7, 2013 at 23:24 Comment(0)
B
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!

Behah answered 17/6, 2016 at 10:43 Comment(1)
Its worked for me.by adding extra empty column into table, my report in pdf format doesn't show the extra blank pages..!Koenraad
T
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.
Transistorize answered 10/4, 2012 at 21:13 Comment(0)
M
5

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

Marashio answered 18/12, 2014 at 19:28 Comment(0)
U
5

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

Undesigning answered 29/1, 2018 at 15:41 Comment(0)
E
4

I fixed this issue by doing the following. ( Using the latest version of Report Builder )

Step 1.) Go to View Tab
Step 2.) Check the Properties checkbox enter image description here
Step 3.) Click inside the body of your report (it will update values in properties tab) enter image description here
Step 4.) Take not of the width here
Step 5.) Right click in the gray area outside the report and click report properties enter image description here
Step 6.) Add your left + right margin to your body width ( if that equals 10 then make your width 11) enter image description here
Step 7.) Save

Ethnography answered 22/6, 2021 at 13:36 Comment(1)
Can you explain how your math adds up? 9.06476 + 0 + 0 != 9.2, 8.42861 + 0.5 + 0.5 != 11.69. And in Step 6, what do you mean by "if that equals 10 then make your width 11"? Do you mean to take left + right + 1 ?Roar
C
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.

Carnivorous answered 20/3, 2017 at 21:57 Comment(0)
E
2

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

Essay answered 25/3, 2021 at 16:4 Comment(1)
This has solved my issue. At the right side I had to much white and empty part. By removing it solved my problem.Gambrinus
S
1

I just reduced all elements Width shorter than 8 inch and it is being corrected, I did that with mouse, your report Body should be shorter than 8 inch.

Shell answered 7/12, 2021 at 13:7 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Jiggermast
B
0

I hope from above all explanations the issue might get resolved But I want to add my point of view here.

You need to check all the spaces after the items such as rectangle, matrix or table and try minimize it. And the 2nd way is if still you're getting more pages then try to reduce the gap between the items present in your report. It works for me in this way.

Thanks

Bessette answered 31/7, 2023 at 6:21 Comment(0)
Z
-4

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

Zoraidazorana answered 12/12, 2008 at 15:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.