import EditButton from '../src/components/Docs/EditButton' import NavigationButtons from '../src/components/Docs/NavigationButtons'
Helper function to render a PDF into a file.
const MyDocument = () => (
<Document>
<Page>
<Text>React-pdf</Text>
</Page>
</Document>
);
await renderToFile(<MyDocument />, `${__dirname}/my-doc.pdf`);| Prop name | Description | Default |
|---|---|---|
| document | Document's root element to be rendered | undefined |
| path | File system path where the document will be created | undefined |
| callback | Function to be called after rendering is finished | undefined |
Helper function to render a PDF into a string.
const MyDocument = () => (
<Document>
<Page>
<Text>React-pdf</Text>
</Page>
</Document>
);
const value = await renderToString(<MyDocument />);| Prop name | Description | Default |
|---|---|---|
| document | Document's root element to be rendered | undefined |
String representation of PDF document
Helper function to render a PDF into a Node Buffer.
const MyDocument = () => (
<Document>
<Page>
<Text>React-pdf</Text>
</Page>
</Document>
);
const buffer = await renderToBuffer(<MyDocument />);| Prop name | Description | Default |
|---|---|---|
| document | Document's root element to be rendered | undefined |
Buffer representation of PDF document
Helper function to render a PDF into a Node Stream.
const MyDocument = () => (
<Document>
<Page>
<Text>React-pdf</Text>
</Page>
</Document>
);
const stream = await renderToStream(<MyDocument />);| Prop name | Description | Default |
|---|---|---|
| document | Document's root element to be rendered | undefined |
PDF document Stream