Good question.
As I do not use custom GPTs, prefer not to speculate on the exact way to do it but do see that as a very likely way to solve this, e.g.
In looking to give an answer to your question did some more specific searching of using code with a prompt and saw mention that the code interpreter can create PDFs
https://platform.openai.com/docs/assistants/tools/code-interpreter
While this option was not on my previous list, it is something I will take a closer look at. If something of value results from that I will post here.