@paprize/react
PageInfo
Defined in: react/src/internal/eventHelper.ts:6
Context information for a paginated page.
Properties
| Property | Type | Description |
|---|---|---|
pageIndex | number | Index of this page within its section. |
totalPages | number | Total 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
| Property | Type | Description |
|---|---|---|
sections | SectionInfo[] | All paginated section within the report. |
SectionInfo
Defined in: react/src/internal/eventHelper.ts:20
Context information for a paginated section.
Properties
| Property | Type | Description |
|---|---|---|
isPaginated | boolean | Indicates whether pagination for this section has completed. |
isSuspended | boolean | Indicates whether pagination for this section is suspended and waiting for the suspension to be resolved. |
pages | PageInfo[] | All paginated pages that belong to this section. |
sectionId | string | Unique identifier of the section. |
sectionIndex | number | Index 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?:boolean;margin?:PageMargin;orientation?:"portrait"|"landscape";plugins?:PaginationPlugin[];size:PageSize;suspense?:Promise<unknown>[]; },"id"|"suspense">
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
hyphen? | string | "-" | Specifies the character used for hyphenation when a word is broken across lines. |
hyphenationDisabled? | boolean | false | Disables 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? | string | undefined | Unique id of the section within the report. If not set, a random id will be used. |
keepOnSamePage? | boolean | false | Prevents an element from being split across pages. If an element does not fit in the available space on the current page, it will be moved entirely to the next page. If it still does not fit on an empty page, it will be skipped and not rendered. |
margin? | PageMargin | undefined | Page margins for this section. |
orientation? | "portrait" | "landscape" | undefined | Page orientation used for this section. Default portrait |
plugins? | PaginationPlugin[] | undefined | List of plugins to use during pagination. |
size | PageSize | undefined | Page size used for this section. |
SectionSuspension
Defined in: react/src/components/useSectionSuspension.ts:8
Controls the section suspension.
Properties
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
defaultDatavalue for testing purposes.
Type Parameters
| Type Parameter | Description |
|---|---|
DataModel | The expected type of the injected JSON data. |
Parameters
| Parameter | Type | Description |
|---|---|---|
defaultValue? | DataModel | Optional 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
useReportInfo()
useReportInfo():
ReportInfo
Defined in: react/src/components/useReportInfo.ts:12
React hook that returns information about the report.
Returns
useSectionInfo()
useSectionInfo():
SectionInfo
Defined in: react/src/components/useSectionInfo.ts:10
React hook that returns information about the current section.
Returns
useSectionSuspension()
Call Signature
useSectionSuspension(
promise):void
Defined in: react/src/components/useSectionSuspension.ts:28
Suspends pagination for this section.
Parameters
| Parameter | Type | Description |
|---|---|---|
promise | Promise<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
| Name | Type | Description |
|---|---|---|
release() | () => void | Releases the suspension. The pagination engine will paginate this section immediately. |
reset() | () => void | Marks 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. |