React renderer for creating PDF files
This project was created to show some concepts on a talk, and it's purely experimental.
ReactPDF mounter is called ReactPDF and has a render method that recieves a React Element and a path where the PDF file will be generated.
import React from 'react';
import ReactPDF from '../';
import lorem from './lorem';
let doc =
<document title="Lorem Ipsum" author="@diegomura" otherData="Something else">
<page margin={50}>
<image src="examples/images/react.png" x={200} y={300} width={200} />
<text align="center" underline>
~ Lorem ipsum ~
</text>
<text columns={3} columnGap={15} align='justify'>
{lorem}
</text>
</page>
</document>
ReactPDF.render(doc, './examples/example.pdf')
git clone https://github.com/diegomura/react-pdf
cd react-pdf
npm install
# run example script
npm run example
Check out for the example.pdf
file created on the root of the project
- @iamdustan for the explanation of how to build a renderer