How to get total page count printing multiple sheet spread to pdf ?

Posted by: wilfried-fp on 8 September 2017, 2:48 pm EST

  • Posted 8 September 2017, 2:48 pm EST

    I have a spread with multiple sheets to be printed to one pdf; the page count before printing is not known, because some of them need more than 1 page. I found the way to get the page count of a single sheet, but not of the whole spread.
    For the page count of the sheet I used the following code:

    fpMappe.Sheets(i).PrintInfo.Header = "/ds" & "/c" & fpMappe.Sheets(i).SheetName & " Page /p" & " of /pc"

    I need the total page count (this could work with adding the values of "Spread.GetPrintPageCount(sheetindex)"

    but I also need the pageNr relative to the total page count ( /p is only the number within ONE sheet)

     Thanks, wilfried



  • Replied 8 September 2017, 2:48 pm EST

    Sorry, found the solution by myself:

    Dim totalPagesL As Integer = 0
    Dim actPageNrL As Integer = 1
    Dim actPagesL As Integer = 0
    For i As Int32 = 0 To fpMappe.Sheets.Count - 1
                actPagesL = fpMappe.GetPrintPageCount(i)
                totalPagesL += actPagesL
                fpMappe.Sheets(i).PrintInfo.FirstPageNumber = actPageNrL
                actPageNrL += actPagesL
    For i As Int32 = 0 To fpMappe.Sheets.Count - 1
         fpMappe.Sheets(i).PrintInfo.Header ="Page /p" & " of " & totalPagesL.ToString

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels