Skip to main content

@paprize/react

PageInfo​

Defined in: react/src/internal/eventHelper.ts:6

Context information for a paginated page.

Properties​

PropertyTypeDescription
pageIndexnumberIndex of this page within its section.
totalPagesnumberTotal number of pages in the section that contains this page.

ReportInfo​

Defined in: react/src/internal/eventHelper.ts:47

Context information for pagination cycle.

Properties​

PropertyTypeDescription
sectionsSectionInfo[]All paginated section within the report.

SectionInfo​

Defined in: react/src/internal/eventHelper.ts:20

Context information for a paginated section.

Properties​

PropertyTypeDescription
isPaginatedbooleanIndicates whether pagination for this section has completed.
isSuspendedbooleanIndicates whether pagination for this section is suspended and waiting for the suspension to be resolved.
pagesPageInfo[]All paginated pages that belong to this section.
sectionIdstringUnique identifier of the section.
sectionIndexnumberIndex of the section within the report.

SectionProps​

Defined in: react/src/components/Section.tsx:15

Configuration options for a section.

Extends​

  • Omit<{ hyphen?: string; hyphenationDisabled?: boolean; id: string; keepOnSamePage?: KeepOnSamePageOptions; margin?: PageMargin; orientation?: "portrait" | "landscape"; plugins?: PaginationPlugin[]; size: PageSize; suspense?: Promise<unknown>[]; }, "id" | "suspense">

Properties​

PropertyTypeDefault valueDescription
hyphen?string"-"Specifies the character used for hyphenation when a word is broken across lines.
hyphenationDisabled?booleanfalseDisables automatic word hyphenation. When disabled, if a word (a sequence of text without whitespace) does not fit on the current page, it will move to the next page instead of being split with a hyphen character.
id?stringundefinedUnique id of the section within the report. If not set, a random id will be used.
keepOnSamePage?KeepOnSamePageOptionsfalsePrevents an element from being split across pages.
margin?PageMarginundefinedPage margins for this section.
orientation?"portrait" | "landscape"undefinedPage orientation used for this section. Default portrait
plugins?PaginationPlugin[]undefinedList of plugins to use during pagination.
sizePageSizeundefinedPage size used for this section.

SectionSuspension​

Defined in: react/src/components/useSectionSuspension.ts:8

Controls the section suspension.

Properties​

PropertyTypeDescription
release() => voidReleases the suspension. The pagination engine will paginate this section immediately.
reset() => voidMarks the suspension as pending again if it was previously resolved. During the next pagination cycle (for example, if pagination is retriggered by changes to the page content), this section will not be paginated until release is called again.

useJsonData()​

useJsonData<DataModel>(defaultValue?): DataModel | null

Defined in: react/src/components/useJsonData.ts:8

Retrieves JSON data injected by @paprize/puppeteer during server-side rendering (SSR).

If no injected data is available, the function returns the provided defaultData, or null if none is given.

⚠️ Important Notes:

  • This function is not type-safe — it performs no runtime type validation on the returned data.
  • It is available only during server-side rendering when using @paprize/puppeteer.
  • When used in client-side rendering or development mode, you should provide a defaultData value for testing purposes.

Type Parameters​

Type ParameterDescription
DataModelThe expected type of the injected JSON data.

Parameters​

ParameterTypeDescription
defaultValue?DataModelOptional fallback value to return if no injected data is found.

Returns​

DataModel | null

A promise resolving to the injected JSON data if available, otherwise the provided default value or null.


usePageInfo()​

usePageInfo(): PageInfo

Defined in: react/src/components/usePageInfo.ts:8

React hook that returns information about the current page.

Returns​

PageInfo


useReportInfo()​

useReportInfo(): ReportInfo

Defined in: react/src/components/useReportInfo.ts:12

React hook that returns information about the report.

Returns​

ReportInfo


useSectionInfo()​

useSectionInfo(): SectionInfo

Defined in: react/src/components/useSectionInfo.ts:10

React hook that returns information about the current section.

Returns​

SectionInfo


useSectionSuspension()​

Call Signature​

useSectionSuspension(promise): void

Defined in: react/src/components/useSectionSuspension.ts:28

Suspends pagination for this section.

Parameters​

ParameterTypeDescription
promisePromise<unknown> | Promise<void>The suspension is tied to this promise. Once the promise is resolved, the suspension is released and the pagination engine will paginate this section.

Returns​

void

Call Signature​

useSectionSuspension(): object

Defined in: react/src/components/useSectionSuspension.ts:35

Suspends pagination for this section. You need to call the release method of the returned value; otherwise, the pagination engine will never paginate this section.

Returns​

NameTypeDescription
release()() => voidReleases the suspension. The pagination engine will paginate this section immediately.
reset()() => voidMarks the suspension as pending again if it was previously resolved. During the next pagination cycle (for example, if pagination is retriggered by changes to the page content), this section will not be paginated until release is called again.