ssrs report viewer vs exported pdf page count - pdf

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.

Related

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.

Possible to control PDF layout with iText?

I'm writing some logic to build a large single PDF file that our users can print at their convenience. I'm using Java's iText library (through Clojure's clj-pdf).
I'm trying to have the PDF show the same exact template form on every single page, however I can't seem to find any documentation or indication that one can have PDF content "fit to a page".
The text in these forms varies a little bit, so there's a chance it might require more of fewer text lines per page. This means that the content has a chance of spilling over to the next page, or being too short, making the next page creep up into the previous one, breaking the requirement of "one form per page" for the rest of the document.
I'm trying to figure out if my option is pretty much only to manually check the length of the text on each page and potentially crop it by hand if I goes over n lines, or if the PDF format somehow supports a smart way of having paragraphs+tables+headings all fit in one page. Some UI systems allow you to control how spill-over is handled, anywhere from cropping to resizing the font, so I'm curious if PDF supports anything of that sort.
Edit: ended up going with pagebreaks for simplicity, wasn't aware of that option when I wrote this question.
If you want to take control over the space taken by text, for instance to fit it on a single page, the way to go would be to create a ColumnText object and to add the content in simulation mode. If the text fits the page, add it for real. If it doesn't, use a smaller font size. This is demonstrated in the MovieAds example where snippets of text are fitted into AcroForm fields.

How to limit RDLC report for one page in a PDF

I have a RDLC report and I am displaying it on the Report Viewer Control in my front end application. I get the report perfectly and theres no problem in it.
But the problem arises when I try to export the report to a PDF (using available option - basically the inbuilt option).
I get the report in 3 pages whereas my client wants it to be in a single page. I am not able to figure out the reason for it as in my report viewer I see only one page but in a PDF there are 3 pages. I have only four columns with no data, still they are breaking up into multiple pages. 2 columns on 1st page 2 on second page. Not real sure what happened to the 3rd page. Somebody recommended changing the paper size of the default printer but I didn't think is was worth trying.
Can something be done abt it so that I can control the size of the report???
This can be a real PITA but there are several things you can do to get you there in BIDS.
To see what it will look like as a pdf use the "Print Layout" button on the preview mode toolbar.
Goto the report properties and set the orientation and paper size as you need them.
Remember the margins in the report properties to make your report display area smaller. I generally set these smaller than the defaults.
Go back to you report items and make sure they are smaller than (pagesize - margins)
This should help.
you can try setting InteractiveHeight=0 , I know that at least works for the MHTML output, not sure about PDF, but it might lead you in the right direction

Debugging Paging in Sql Reporting Services

I'm working on my first significant Sql Reporting Services project and am having problems with paging. Most of the reports are already working.
What is happening is that I"m getting different numbers and locations of page breaks between Web Reportviewer, PDF and Word documents. The word is the closest, but none of the three are really correct.
I've looked for the for the obvious like extra paging and making sure the report does not go outside of the left or right margins. My problem is that I'm not sure how to go about troubleshooting reports that pages that do not break in the correct location.
Does anyone have a suggestion where to start?
I'm using VS2008, SQL2008 DE on Vista Dev box.
This isn't really a problem - the different renderers are rendering the report appropriately for their output. The web viewer is optimised for screen-based reading and generally allows more content per page than the PDF viewer does as the PDF viewer is constrained by the paper size that it formats to. Thus you get more pages when rendering for PDF than web; however, the content of the report is exactly the same.
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. 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 web renderer page length is determined by the InteractiveHeight attribute of the report (in the InteractiveSize property in the Properties pane for the report) but the interactive height is an approximation rather than a fixed page break setting and your page breaks may still not conform to the PDF version even though the InteractiveHeight is set to the same length as your target page length.

SSRS05 A one page report in preview shows a second page with only footer in print layout

I have a user sign off report where it shows a users rights/access to the system which all fits nicely onto one page when I hit preview. However when I then go to print layout it shows me two pages with the second page only containg the footer.
Any ideas please?
Are you sure the page size matches the paper size?
If so, have you tried setting the page footer's PrintOnLastPage property to false? Then again, if you really need that footer to be there (seeing that there's only one page), you might have to try fiddling with the margins to get it to fit within the first page.
The report size at design time, plus the margins must be less than the paper size. Sometimes you can have a report that is too wide that is essentially generating a blank page "to the right" rather than underneath the first page.
Yes I have scrunched it all up so that it is WELL within the page size and I have tried all combinations of Footers (and headers).
It is a slightly wierd report in that it has fields that need to grow to show all the information and a small table too, but even at full growth the data looks like it fits on one page (in preview in Visual Studio) but as soon as it goes to print preview and printing it reverts to two pages.
Make sure you do not have extra area to the right of the last field of the report.
Are you sure you've adjusted the report's display size in the property sheet, too?
Hope this helps,
Bill