I can only think of one rational possibility.
You can bring the data for the .PDF into your program using SQL. Your program copies the data to a streamfile, and then prints the .PDF streamfile in whatever way you normally print your .PDFs from streamfiles. The streamfile would be a temporary one that would eventually need to be deleted.
I don’t know if I can find the time to start describing an alternative.