Intrinsic elements
This package defines the following list of intrinsic elements. See https://pdfmake.github.io/docs/0.1/document-definition-object/ for more information.
For more complete usages, please check out the PdfRenderer unit test on the GitHub repo.
Trivial elements
These are defined such that the reasonable content property is made the children
of the element, and that property is made the name of the element. For example:
tsx
/// <reference types="react-pdfmake-reconciler/react-jsx" />import type {ContentText } from "pdfmake/interfaces";import {ReactNode } from "react";// A pdfmake text object is defined like so:consttextObj :ContentText = {text : "Hello World!", // clearly the "children content" of this objectbold : true,};// In react-pdfmake-reconciler, this is defined like so:consttextNode :ReactNode = <pdf-text bold >Hello World!</pdf-text >;
tsx
/// <reference types="react-pdfmake-reconciler/react-jsx" />import type {ContentText } from "pdfmake/interfaces";import {ReactNode } from "react";// A pdfmake text object is defined like so:consttextObj :ContentText = {text : "Hello World!", // clearly the "children content" of this objectbold : true,};// In react-pdfmake-reconciler, this is defined like so:consttextNode :ReactNode = <pdf-text bold >Hello World!</pdf-text >;
Here is the complete list of basic elements that require no further explanation:
tsx
/// <reference types="react-pdfmake-reconciler/react-jsx" />consttext = <pdf-text ></pdf-text >;constcolumns = <pdf-columns ></pdf-columns >;conststack = <pdf-stack ></pdf-stack >;constol = <pdf-ol ></pdf-ol >;constul = <pdf-ul ></pdf-ul >;consttable = <pdf-table ></pdf-table >;constpageReference = <pdf-pageReference >ref</pdf-pageReference >;consttextReference = <pdf-textReference >ref</pdf-textReference >;constimage = <pdf-image image ="myImage" />;constsvg = <pdf-svg svg ="<svg></svg>" />;constqr = <pdf-qr qr ="hello" />;constcanvas = <pdf-canvas canvas ={[]} />;
tsx
/// <reference types="react-pdfmake-reconciler/react-jsx" />consttext = <pdf-text ></pdf-text >;constcolumns = <pdf-columns ></pdf-columns >;conststack = <pdf-stack ></pdf-stack >;constol = <pdf-ol ></pdf-ol >;constul = <pdf-ul ></pdf-ul >;consttable = <pdf-table ></pdf-table >;constpageReference = <pdf-pageReference >ref</pdf-pageReference >;consttextReference = <pdf-textReference >ref</pdf-textReference >;constimage = <pdf-image image ="myImage" />;constsvg = <pdf-svg svg ="<svg></svg>" />;constqr = <pdf-qr qr ="hello" />;constcanvas = <pdf-canvas canvas ={[]} />;
Virtual elements
In addition to the above intrinsic elements, there are also these which are categorized as virtual elements. These are, in one way or another, specially treated by the renderer where the content key doesn't match the name, or they do not correlate to a rendered content object.
tsx
/// <reference types="react-pdfmake-reconciler/react-jsx" />// react-pdf-reconciler only renders into arrays if the `children` contains more than 1 node.// To force returning an array, use this element.constarray = <pdf-array ></pdf-array >;// Use with <pdf-table>consttbody = <pdf-tbody >{[]}</pdf-tbody >;constcell = (<pdf-cell ><pdf-text ></pdf-text ></pdf-cell >);// Use with <pdf-columns>constcolumn = (<pdf-column ><pdf-text ></pdf-text ></pdf-column >);// Use with <pdf-ol> or <pdf-ul>constli = (<pdf-li ><pdf-text ></pdf-text ></pdf-li >);// This is treated as a virtual element since the children is define to be the `title` prop.consttoc = <pdf-toc ></pdf-toc >;
tsx
/// <reference types="react-pdfmake-reconciler/react-jsx" />// react-pdf-reconciler only renders into arrays if the `children` contains more than 1 node.// To force returning an array, use this element.constarray = <pdf-array ></pdf-array >;// Use with <pdf-table>consttbody = <pdf-tbody >{[]}</pdf-tbody >;constcell = (<pdf-cell ><pdf-text ></pdf-text ></pdf-cell >);// Use with <pdf-columns>constcolumn = (<pdf-column ><pdf-text ></pdf-text ></pdf-column >);// Use with <pdf-ol> or <pdf-ul>constli = (<pdf-li ><pdf-text ></pdf-text ></pdf-li >);// This is treated as a virtual element since the children is define to be the `title` prop.consttoc = <pdf-toc ></pdf-toc >;