Convert SVG files to react-pdf
SVG components
#2586
Replies: 1 comment
-
Hey I've tried something like this and this worked for most of the cases `import React, { useEffect, useRef, useState } from "react"; const CaptureAndExportPDF = ({ useEffect(() => {
}, [Component]); useEffect(() => { return <>{imageSrc ? : null}</>; ` |
Beta Was this translation helpful? Give feedback.
-
For a number of stylistic elements in our app, we render
.svg
files as follows:We wanted to be able to render these as SVGs in our PDF exports, so I created a wrapper to convert standard XML syntax to
react-pdf
SVG components:ReactPdfSvg.tsx
Example.tsx
Let me know your comments/thoughts. I have a nagging feeling there might be a better/simpler way to achieve the same result!
Beta Was this translation helpful? Give feedback.
All reactions