Page numbers in SSRS while exporting to pdf file

  • Hi

    I am designing the report in SSRS. In footer I have set the page out of (no. of pages). When I am viewing the report in report viewer it shows me for ex. 1 of 5 pages, 2 of 5 pages... etc...

    When I exporting it to the pdf file the no. of pages increases and output is getting split into more pages. so now it shows me for ex. 1 of 7 pages, 2 of 7 pages.........etc.

    But I want to keep the page numbers consistent with the viewer. so eventhough its divided in 7 pages. the page footer should show like 1 of 5 pages, 2 of 5 pages, 3 of 5 pages, etc..

    is this possible??

    Thanks

    Thanks.

    Gunjan.

  • As far as I know this is not possible, the idea of the viewer is to show pages that have no length limit, they simply keep going until a ThrowPage is received.

    When printing, or exporting to PDF, the expected output is by page size, and therefore you will get new pages every time (for example) the limit of an A4 piece of paper is reached.

    To try to accomplish what you want, you would need to find a way of always having only an A4 page worth of data in a certain group, and throwing a page at the start or end of that group. This would become unworkable pretty wuickly and I wouldn't recommend it as an approach.

    Nigel West.

    Nigel West
    UK

  • Hi,

    Thanks for the reply.

    I have achieved that by storing the result into temp table and then assigning that field value to the attribute/control on the report which will work as a page number like =Field!SrNo.Value & ' of ' & Field!SrNo.Value

    But the new requirement is if viewer shows 5 pages and while exporting to PDF if the page gets increased then for ex. for 3rd record it splits the page in to two. so the idea is to show like 1 of 2 next page 2 of 2 ; even though the pdf document has 7 or any number of pages but for individual record if the page gets split then it should work as per example I mentioned.

    Is there any trick or provision in SSRS?

    Thanks.

    Gunjan.

  • Nothing I can think of I'm afraid, sorry!

    Nigel West
    UK

  • 🙂

    No problem..

    Thanks....

    Thanks.

    Gunjan.

  • I'm sure you have moved on beyond this problem by now. However my users often report this phenomenon when the body dimensions extend (are wider than) the report layout dimenions. If your report layout is 8 1/2 long by 11 wide, with a one inch margin on the left & right, your report body can be no wider than 9 inches. When you export to pdf, the pages seem to grow beyond the preview mode. If you look at the number of pages in the print-preview mode you should see the real number of pages that will be printed or converted to pdf.

    CJ

  • The PDF Writer called PDFEdit995 has a function to number pages in a file.

  • Please provide me the necessary steps to add page n of m concept in sql rs reports.

  • Here's the expression you can add to a text box placed in the header or footer:

    ="Page " & Globals!PageNumber & " of " & Globals!TotalPages

  • hi..

    can u please tell me how to get the total no of pages present in a group in a Report Viewer's Footer.

    I have a report with group by Village_code and i have 2 villages .first village have 25 no of pages and 2nd village have 7 pages.

    I need my OUTPUT SHOULD BE..

    PAGE 1: PAGE 1 OF 25

    PAGE 2: PAGE 2 OF 25

    PAGE 3: PAGE 3 OF 25..ETC FOR VILLAGE 1

    AND FOR VILLAGE 2:

    PAGE 1: PAGE 1 OF 7

    PAGE 2: PAGE 2 OF 7 ETC..

    Please help me how to do it........

  • I don't believe you can include global variables, like page number in a table footer. SSRS does not apper to allow you to start page numbering based on anything like a group by grouping in the header or footer.

  • I had also similar problem before. the problem was that the form was expanding beyond the lay out of the report.

    Go to project -> Report -> layout.

    Make sure the form is trimmed to the boarder of the report lay out.

  • Try this

    Expression for the page numbering...

    ="Page " & Code.GetPN(Not(ReportItems!tag.value Is Nothing),Globals!PageNumber)

    Code for the page numbering...

    Shared offset as integer

    Public Function GetPN(reset As Boolean,pagenumber As Integer) as Integer

    If reset

    offset = pagenumber - 1

    End If

    Return pagenumber - offset

    End Function

  • Put a text box in Header/Footer or wherever you want and in the expression write this, =IIF(Globals!PageNumber = 1, "1", cStr(Globals!PageNumber)) it will show the page number and you can place another textbox before this as label saying Page:

  • As i read your question i found that you have page size problem with SSRS view and PDF view. Please check Page size property for both or you can check it in Printer property(for which is default paper size of default printer).

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic. Login to reply