react-pdf
React renderer for creating PDF files
This project was created to show some concepts on a talk, and it's purely experimental.
Now using the new React Fiber API!
How it works
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 ="Lorem Ipsum" ="@diegomura" ="Something else"> <page => <image ="examples/images/react.png" = = = /> <text ="center" > ~ Lorem ipsum ~ </text> <text = = ='justify'> lorem </text> </page> </document> ReactPDF;
Demo
# Clone the repo git clone https://github.com/diegomura/react-pdfcd react-pdf # Install dependencies yarn install # or npm install # Run example script yarn example # or npm run example # Open example doc open examples/example.pdf
Check out for the example.pdf
file created on the root of the project