Table of Contents

Method GetSectionPageNumber

Namespace
BitMiracle.Docotic.Pdf.Layout
Assembly
BitMiracle.Docotic.Pdf.Layout.dll

GetSectionPageNumber(string)

Gets the current page number relative to the first page of the specified section.

public int? GetSectionPageNumber(string sectionName)

Parameters

sectionName string

The section name.

Returns

int?

The relative page number. 1 means the first section page.

Remarks

The method can return negative values, zero, or numbers greater than section page count. For example, a document contains 5 pages with a section on pages 3-4. This method will return the following values depending on the current page:

  • -1 for the page 1.
  • 0 for the page 2.
  • 1 for the page 3.
  • 2 for the page 4.
  • 3 for the page 5.

The library performs 2 passes when generating the document. First time, the library calculates the total number of pages in the document and finalizes content. Second time, the library renders the content of the document. You can detect the current pass using the LayoutCompleted property.

The section sectionName may not exist when this method is called on during the first pass. This method returns null in such cases.

The related section must always exist during the second pass. This method throws LayoutException when the section is not found during the rendering.

Exceptions

LayoutException

The section does not exist during the document rendering.

See Also