First PDF export attempt
This commit is contained in:
@ -2,6 +2,9 @@ import React from "react";
|
||||
import f3 from "family-chart";
|
||||
import "./family-chart.css";
|
||||
|
||||
import { jsPDF } from "jspdf";
|
||||
import "svg2pdf.js";
|
||||
|
||||
export default class ComlexFamilyTree extends React.Component {
|
||||
cont = React.createRef();
|
||||
|
||||
@ -219,6 +222,20 @@ export default class ComlexFamilyTree extends React.Component {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
const doc = new jsPDF({
|
||||
orientation: "l",
|
||||
format: [1000, 1000],
|
||||
});
|
||||
|
||||
const element = document.getElementById("FamilyChart");
|
||||
console.log(element);
|
||||
doc.svg(element!.children[0], { height: 1000, width: 1000 }).then(() => {
|
||||
// save the created pdf
|
||||
doc.save("myPDF.pdf");
|
||||
});
|
||||
}, 6000);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
Reference in New Issue
Block a user