diff --git a/src/index.tsx b/src/index.tsx index c8b2bda..8302748 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -60,7 +60,10 @@ const renderTextElement = ({ }; // Converts a web-based SVG element to a react-pdf SVG element -const webSvgToPdfSvg = (children: React.ReactElement, chartStyle?: Style) => { +export const convertHTMLToPDF = ( + children: React.ReactElement, + chartStyle?: Style, +) => { const svgString = renderToStaticMarkup(children); if (!svgString?.length) { @@ -358,7 +361,7 @@ const webSvgToPdfSvg = (children: React.ReactElement, chartStyle?: Style) => { * @example * * - * + * * * * @@ -367,7 +370,7 @@ const webSvgToPdfSvg = (children: React.ReactElement, chartStyle?: Style) => { * */ const ReactPDFChart = ({ children, chartStyle, debug, style }: PropsType) => { - let component = webSvgToPdfSvg(children, chartStyle); + let component = convertHTMLToPDF(children, chartStyle); // This should never happen, but it's here for type safety if (!component || typeof component === 'string') return <>{component};