none
Pagination showing negative number while exporting to PDF

    Question

  • HI,

    I am using SQL 2005 and I am resetting the page to 1 for each new group (CUSTOMER_CODE) with page break at end. 

    I am using the below VB code to reset the page:

    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

    ANd then referring this function in page header to reset the page no. to 1 for each new customer on new page. 

    Everything works fine with pagination and resetting also correctly both in local visual studio as well as in web browser. But the problem comes when export to PDF in which it is not displaying correct values and showing some random negative number for the page.

    Can you advise do I need to change the above VB code or to set some other property so that it can work for PDF as well.

    Thanks

    Wednesday, August 07, 2013 4:13 AM

Answers

  • Able to achieve it using below code:


    Shared offset as Integer
    Shared currentgroup as Object

    Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object
    If Not (group = currentgroup)
    offset = pagenumber - 1
    currentgroup = group
    End If
    Return pagenumber - offset
    End Function

    • Marked as answer by UltraDev Friday, August 09, 2013 4:26 AM
    Friday, August 09, 2013 4:26 AM

All replies

  • Any suggestion?
    Wednesday, August 07, 2013 6:16 AM
  • Hi UltraDev,

    The PDF renderer is a physical page renderer and, therefore, has pagination behavior that differs from other renderers such as Web archive (MHTML) and Excel. The physical page size is the paper size, and the default page size is 8.5 x 11 inches. If the report body grows past the right edge of the physical page, then a page break is inserted horizontally. If the report body grows past the bottom edge of the physical page, then a page break is inserted vertically. 

    The issue can be caused by that the report body size is larger than the default paper size, so when you export report to PDF, some page break in inserted, and then the page number on the PDF file is incorrect.  So in your scenario, please ensure that the report body size is less than 8.5 x 11 inches and check whether this isssue is persists.

    Reference:

    Hope this helps.

    Regards,


    Charlie Liao
    TechNet Community Support

    Thursday, August 08, 2013 7:48 AM
    Moderator
  • Able to achieve it using below code:


    Shared offset as Integer
    Shared currentgroup as Object

    Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object
    If Not (group = currentgroup)
    offset = pagenumber - 1
    currentgroup = group
    End If
    Return pagenumber - offset
    End Function

    • Marked as answer by UltraDev Friday, August 09, 2013 4:26 AM
    Friday, August 09, 2013 4:26 AM