You really need to decide on your toolset for generating the PDF first and based on what capabilities it has will determine what / how you will access the data.
Accessing the local DB is not recommended for a number of reasons and should be discounted as an option
Using Open UI to gather and send the data to the generator is certainly a good option if the generator you select has the appropriate APIs to embed into an Open UI control. Failing the API you could still use Open UI to gather the data and output the temporary file and then call the generator referencing the temp file.
I would start with researching your toolset options and go from there.
Sorry I can't be more specific.
--Bill