Hi Ruak
Most of the time, generating a PDF is done through a third‑party service, which you can call either with custom code or via an API call.
We have some community members discussing which services to use here:
Hope this helps