I am looking to generate PDFs with the filled out forms

Is there a way to generate HTML in nodejs using the schema, uischema, data? I want it to look the same as the materialRenderers. The basic concept is to display the forms and let people fill them out and persist all pieces in the DB and then be able to print the form as a PDF.

[original thread by shua Talansky]

Isn’t the regular approach of developing a React app sufficient? For example take a look at the React seed. All you need to do is to build in some communication to your backend (for example via REST), run npm run build and serve the output from any webserver.

[shua Talansky]

Let me explain better. If I want to render it as HTML I need it to look identical to what the client sees on his screen but I want it to be a server process that generates this markup to create a PDF out of it and email it to the client.
Below is a component that is passed to ReactDOMServer.renderToString I get the following error and it does not render Warning: useLayoutEffect does nothing on the server

<JsonForms
      schema={schema}
      uischema={uischema}
      data={data}
      renderers={renderers}
      cells={materialCells}
      onChange={({ data, _errors }) => setData(data)}
    />

[shua Talansky]

@sdirix(sdirix) I appreciate your interest in my question. Do you understand my question? Any other thoughts?

Whether you use server side rendering or not doesn’t change anything in principle. Either way you need to get the data back to the server for further processing, in your case to create a PDF.

Regarding server side rendering:

  • Material UI is not that easy to render on the server as it requires certain media queries to be available. You’ll need to mock them to render anything

  • When you get useLayoutEffect warnings then you’re on an older version of JSON Forms. Please update to 2.5.0