import React, { useRef } from "react";
import { Button, Input, Textarea } from "@/components/ui";
import html2canvas from "html2canvas";
import jsPDF from "jspdf";
const PDFGenerator = () => {
const pdfRef = useRef();
const generatePDF = () => {
const input = pdfRef.current;
html2canvas(input).then((canvas) => {
const imgData = canvas.toDataURL("image/png");
const pdf = new jsPDF("p", "mm", "a4");
const imgWidth = 210;
const pageHeight = 297;
const imgHeight = (canvas.height * imgWidth) / canvas.width;
let heightLeft = imgHeight;
let position = 0;
pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight);
heightLeft -= pageHeight;
while (heightLeft > 0) {
position = heightLeft - imgHeight;
pdf.addPage();
pdf.addImage(imgData, "PNG", 0, position, imgWidth, imgHeight);
heightLeft -= pageHeight;
}
pdf.save("document.pdf");
});
};
return (
);
};
export default PDFGenerator;
CONVENTION DE FORMATION PROFESSIONNELLE
(Articles L. 6353-1 et D.6353-1 du Code du travail)
Entre l'organisme de formation
Représentée aux fins des présentes par MARYLENE BERTIN en sa qualité de représentant, dûment habilité.
Déclaration d’activité en cours auprès du PRÉFET DE LA RÉGION des Pays de la Loire.