Expanding textbox stopping page breaks in PDF conversion - pdf

I have a simple report that has an image and a textbox within the body (a rectangle). The textbox is set to 'Allow Height to Increase'. The rectangle is set to 'Page Break After'.
Normally this works fine if the contents of the textbox span a few lines. However, when the textbox expands over multiple pages the Page Break is ignored. This only happens when exporting to PDF, yet works as expected in Preview mode.
I'm hoping someone has some insight into this behaviour or can recommend an alternative page structure that will achieve the desired results.

Could you please check the Rectangles property
kept contents together on a single page
in a parent Rectangle object, this will always keep items together where possible.
You could also set page setup settings (margins, gutters, printable page size...) to make sure that they are not affects on exported PDF document.

Related

SSRS textbox clipping when exporting to PDF

I was working with an SSRS report that uses multiple textboxes in a list control. I found that when I ran and exported my report to PDF (and printed/exported to .XPS), certain textboxes would just ever so slightly get clipped.
Note: when the report rendered in SSRS development env., every textbox looked fine and the text never got clipped. The issue just occurs when exporting, and on seemingly random textboxes (random to me).
I've tried adjusting the height and width properties of the textboxes, and the CanGrow property to true/false. Even making the text a different size (like 5 point) or even a different font made no difference. The amount of text that filled the field didn't matter. I made sure the margins on the page were sufficient. I also made sure there were no other report objects that were overlapping the offending textboxes. Neighboring textboxes that displayed fine were set to be perfectly aligned vertically with ones that had the text problems, and still no luck.
None of these options above worked. I have also seen a few questions on stackoverflow that are similar, but not exact.
How do I keep these textboxes from clipping the text when exporting to PDF?
Thank you.
Sample: textbox text is cut off very slightly on SSRS report exported to PDF for certain textboxes
I have solved my own issue after some tinkering, though perhaps its not the best solution out there but it works.
I hard coded a space character at the end of each textbox field's expression that had the clipping issue,
For example:
=First(Fields!zipCode.Value) + " "
The only minor draw back is that it shifts the alignment of the text left by one space. Hope this helps.
I played around with all sorts of options with indent, padding and even added a gutter column. This seemed to work for a while but when the problem raised its head again, I just changed my font.
I think there might be something up with "Calibri" and "Calibri Light" but "Candara" seems fine.
Bit frustrating this only shows up on server generated pdfs as it makes the feedback loop so much longer.

How to break a SSRS Report page only in PDF?

I am using BIDS to develop a report that needs to be configured in one page when viewed on the internet explorer but still needs page breaks for good display in PDF when exported. The problem is that when i insert page breaks beetween tables another page is added to the report and i only want that in the PDF. Is there any way i can insert page breaks in the PDF but not on the report view itself?
You can achieve this by setting the InteractiveSize property to the wanted value (0 can be used to make it infinite).
If you wish to keep the same width, then you should only change the Height.
Edit: Defining specific page breaks will always force the viewer to use paging as well. This was implemented to improve the performance of large reports to allows users to begin viewing the initial pages of the report while waiting for additional pages to become available.
HTML and Excel output shows a report as a single page if there are no
page breaks. If you do specify InteractiveHeight and InteractiveWidth,
the HTML and Excel output formats render reports using soft page
breaks. Soft page breaks are placed on a page using an estimated page
size, which makes the size of the reports less exact than reports
produced by an output format that supports page size. Soft page breaks
are calculated at run time by the control. Although it is not
recommended, you can disable soft page breaks by setting
InteractiveHeight to 0.
Source: Defining Page Size and Page Breaks in a ReportViewer Report
As described in the quote above, the InteractiveHeight is used to apply soft page breaking when using the report viewer. So the solution is to only use soft page breaks.
You can manipulate your report to break correctly with paging without using hard page breaks by wrapping the wanted blocks inside rectangles. These rectangles you then re-size to be the size of a page and set the property KeepTogetheras true.
This will try to fit the content of the rectangles on the same page, adding a break when you reach the next rectangle. Because your InteractiveSize has no limit, this will not be displayed in the report viewer.

ssrs report viewer vs exported pdf page count

The number of pages displayed when viewed in ReportViewer and in exported PDF are differing.
Eg: 50 records are shown in one single page of Report Viewer. But when Exported to PDF 45 reords come in page 1 and the remaining come in page 2.
Soution Tried:
1)Removed Top and Bottom Margins.
2)Reduced "Interactive Page Size" to match the page count.
But it is not consistent, as it is behaving differently with different number of records.
Can anyone tell me how should I proceed to achieve sync between the ReportViewer and exported PDF ?
Thanks
Short answer - you can't do what you are trying to do: the different renderers handle pagination differently, but appropriately for their output.
The HTML renderer is optimised for screen-based reading and generally allows more content per page than the print renderer does as the print renderer is constrained by the paper size that it formats to. Thus the HTML renderer allows more content on fewer pages for a better browser experience whereas the print and PDF renderers have to conform strictly to the page length.
The best illustration of this is the Excel renderer - the Excel renderer renders the entire report onto a single worksheet in most cases (for reports with grouping and page breaks set on the group footer it will render each group on its own worksheet). You wouldn't want the Excel renderer to artificially create worksheets to try to "paginate" your report or to put it all in one worksheet but insert the header into the spreadsheet rows every "page". It does the appropriate thing which is to include all the data in one big worksheet even though that may be logically thought of as one big "page".
The HTML renderer page length is determined (more accurately, influenced) by the InteractiveHeight attribute of the report (in the InteractiveSize property in the Properties pane for the report). However, the interactive height is an approximation rather than a fixed page break setting and your page breaks may still not conform to the print version even if you set InteractiveHeight to the same length as your target page length. This is because the HTML renderer will vary the page length to group the data together better so the interactive page breaks happen around about, but not always exactly, where the interactive height is set.
This is what is happening in your scenario where the report viewer shows 50 records on one page but the PDF has 45 on the first page and 5 on the second page. The report viewer is making the decision that since there are only a few records left to display it will just include them all on the one page rather than force the user to scroll even though the interactive height will be exceeded. Thus you get a better user experience but a variance in pages between renderers. The important thing about the report is the data and the experience with working with that data in that renderer, not that the pages are the same length no matter how you look at it.
See this discussion of rendering behaviour for more information on why what you are trying to achieve isn't achievable. Just educate your users that the browser pagination is optimised for their viewing pleasure.

Dynamic Data in an RDLC Report Footer across Multiple Pages

I created an RDLC report (based on a stored procedure) that contains lists. I need to display data from one of those lists in the report footer across every page. However this data only shows in a list on the first page, so that is the only page on which it shows in the footer also. I’ve researched this but haven’t found much information. Does anyone have a solution for this?
Something you can try, don't know for sure if it will work. Create a formula that returns the data you want to display, then put the formula field on a text area in the footer.
I ended up placing a textbox in the second page area, setting the text color to white and sending it to the back. If I hid the textbox (or table - I tried that too), the footer object could not reference it. So, setting the text color to white and placing it behind another object worked. It seems like this is a kludgy way to do a simple report operation but is apparently necessary.

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

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?
In BIDS or SSDT-BI, do the following:
Click on Report > Report Properties > Layout tab (Page Setup tab in SSDT-BI)
Make a note of the values for Page width, Left margin, Right margin
Close and go back to the design surface
In the Properties window, select Body
Click the + symbol to expand the Size node
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)
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.
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.
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:
In the design surface, sometimes the editor will create a page which is larger than the actual controls; hence the ghost area being printed.
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.
Then try to create a PDF and see if that fixes it.
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.
Also in some circumstances one can just change a property of the report page by setting ConsumeContainerWhitespace to true to automatically consume the spaces.
The problem for me was that SSRS purposely treats your white space as if you intend it be honored:
As well as white space, make sure there is no right margin.
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.
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!
In addition to the margins, the most common issue by far, I have also seen two additional possibilities:
Using + to concatenate text. You should use & instead.
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.
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.
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.
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.
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
Step 3.) Click inside the body of your report (it will update values in properties tab)
Step 4.) Take not of the width here
Step 5.) Right click in the gray area outside the report and click report properties
Step 6.) Add your left + right margin to your body width ( if that equals 10 then make your width 11)
Step 7.) Save
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.
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.
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.
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