How can I create a PDF while playing my games build and then display it to the player ?

I am creating a score system that will allow for a local save of your scores, but I am unable to figure out how to do this. I am creating a WEBGL build and I am unable to access the game directory to save a PDF.

If you are going to open the PDF in browser, you can use data URL