import ReactPDF, { Document, Page, Text, View, Image, StyleSheet, PDFViewer, Font, } from "@react-pdf/renderer"; import { createElement } from "react"; import Html from "react-pdf-html"; import { getFormCollectionByID } from "../../components/utils"; import renderers, { renderBlock } from "react-pdf-html/dist/renderers"; const styles = StyleSheet.create({ page: { backgroundColor: "white", padding: 20, fontSize: 16, paddingBottom: 50, }, header: { fontSize: 25, fontFamily: "Helvetica", flexDirection: "row", justifyContent: "space-between", }, subHeader: { fontSize: 20, }, logoImage: { width: "200pt" }, questionBullet: { width: "5%", fontSize: 12 }, questionText: { width: "30%", fontSize: 12 }, questionTextMid: { width: "80%", fontSize: 12 }, questionTextWide: { width: "95%", fontSize: 12, marginBottom: 5 }, questionAnswer: { color: "#757575", width: "65%", fontSize: 12, padding: 5, border: 1, borderColor: "#eee", paddingLeft: 10, backgroundColor: "white", }, questionAnswerMid: { color: "#757575", width: "20%", fontSize: 12, padding: 5, border: 1, borderColor: "#eee", paddingLeft: 10, backgroundColor: "white", }, questionAnswerWide: { color: "#757575", width: "95%", fontSize: 12, marginLeft: "5%", border: 1, borderColor: "#eee", backgroundColor: "white", padding: 5, }, sectionContainer: { backgroundColor: "#F8F8F8", padding: 10, marginTop: 20, fontSize: 15, }, pageNumber: { position: "absolute", fontSize: 12, bottom: 20, left: 0, right: 0, textAlign: "center", color: "grey", }, richArea: { fontSize: 12, color: "red", flexDirection: "column", }, }); export const statement_pdf = ({ docProps }) => { //console.log("----", docProps); function formatDates(dateObj) { var dateObj = new Date(dateObj); var dd = String(dateObj.getDate()).padStart(2, "0"); var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0! var yyyy = dateObj.getFullYear(); return dd + "/" + mm + "/" + yyyy; } let values = docProps; let datestr = values.pinswg_name.split("-"); let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; let appealTypeValue = getFormCollectionByID(values.appealType); return ( Statement For Planning, Conservation area, Listed Building and Advertisement applications/appeals Case details 1. PEDW reference: {values.caseRef} 3. Site address/grid ref: {values.siteAddress} 4. Case Type: {appealTypeValue.value} Comments 5. Statement {values.representationComments} Supporting documents 11. List of attached files {values.filesList.map(function (p) { return ( {p.name} - {p.size} ); })} Declaration Signed: {values.firstname} {values.lastname} Date: {signedDate} On behalf of: {values.representationCapacity} `${pageNumber} / ${totalPages}` } fixed /> ); };