jspdf-react
Install
npm install --save jspdf-react
⚠️Note: Use CSS-in-JS, Styled-Component or emotion.
If you want to convert an html in pdf, I recommend using the library. https://github.com/eKoopmans/html2pdf.js
Usage
import React Component from 'react' import PDF Text AddPage Line Image Table Html from 'jspdf-react' import OctoCatImage from './OctoCatImage' const styleH1 = fontSize: '15px' textAlign: 'center' color: 'red'; const invisibleStyle = display: 'none'; { const properties = header: 'Acme' const head = "ID" "Name" "Country" const body = 1 "Shaw" "Tanzania" 2 "Nelson" "Kazakhstan" 3 "Garcia" "Madagascar" return <React.Fragment> <PDF = = > <Text = = =>Octonyan loves jsPDF</Text> <Image = = = = = /> <AddPage /> <Table = = /> <AddPage ='a6' ='l' /> <Text = = ='red'>Sample</Text> <Line = = = =/> <AddPage /> <Html ='page' /> </PDF> <div ="page" => <h1 =>Source Html</h1> <p> <strong>lorem ipsumLorem </strong>Ipsum is simply dummy text of the printing and typesetting industry Lorem Ipsum has been the standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book It has survived not only five centuries but also the leap into electronic typesetting remaining essentially unchanged It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum </p> </div> </React.Fragment> }
License
MIT © apipemc