PDFs can be generated programmatically in several ways. A common use case is converting a website to PDF, but some of the tools listed below work for other use cases too.

Converting a website to PDF

If you’re okay with text not being selectable or searchable, you could use html-to-image to turn the site into images, and then put the images into a new PDF with jsPDF. Use JPEGs so the resulting file isn’t too big.

If you’re willing to rewrite some of the site’s code, you can define the PDF in full detail using react-pdf, which is similar to React Native.

If you would prefer generating PDFs on a server and sending them to the client, you could set up Puppeteer, which can apparently create PDFs that look almost identical to the site but also keep the text selectable and searchable.

Other options

There are also web APIs and many other tools for generating PDFs. I’m not sure all of these are good, but they look promising.