Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zengxiaoluan/react-svg-pdf
https://github.com/zengxiaoluan/react-svg-pdf
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/zengxiaoluan/react-svg-pdf
- Owner: zengxiaoluan
- License: mit
- Created: 2023-12-05T09:54:16.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2023-12-05T10:04:27.000Z (12 months ago)
- Last Synced: 2023-12-05T11:27:43.665Z (12 months ago)
- Language: TypeScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-svg-pdf
The goal of `react-svg-pdf` is to help you build pdf more easily, If you know how to create svg, you also know how to create pdf.
## How to use?
```shell
npm i react-svg-pdf -S
```Next, you can write your familiar SVG code like below, that will make a heart for you.
```jsx
import ReactPDF from "react-svg-pdf";
import React from "react";
import jsPDF from "jspdf";function App() {
return (
<>
>
);
}let pdf = new jsPDF({ orientation: "p" });
ReactPDF.render(
,pdf,
() => {
let embed = document.getElementById("app") as HTMLEmbedElement;
if (embed) embed.src = pdf.output("bloburi") as any;
}
);```