Skip to content

Instantly share code, notes, and snippets.

View OliverLeighC's full-sized avatar

Oliver Coley OliverLeighC

  • MITRE
View GitHub Profile
export function encodeSvgString(svg: string) {
const decoded = unescape(encodeURIComponent(svg));
const b64String = btoa(decoded);
const imgSource = `data:image/svg+xml;base64,${b64String}`;
return imgSource;
}
export function svgToDataURI(svgData: string, renderWidth: number, renderHeight: number) {
const id = genUUID();
@OliverLeighC
OliverLeighC / TransformationBug.tsx
Last active April 22, 2021 18:00
TransformationBug
import React from 'react';
import { Document, Page, Text, View, StyleSheet, Svg, G, Rect } from '@react-pdf/renderer';
const TestChart = (
<Svg
style={{ fontFamily: "Helvetica", fontSize: "12px" }}
width="600"
height="600"
viewBox="0 0 600 600"
>
@OliverLeighC
OliverLeighC / fullSvgChart.svg
Last active April 30, 2021 16:09
React-PDF Svg Chart Options
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.