Replace text in pdf or docx file

Hello, I want to give a certificate at the end of the game. I have template for this in docx file. I can convert this to pdf file.

But the problem is I have to change the name part in document. So, I have to replace this section with user name. In word file or pdf file, how can i do it? I have been searching for 2 days but i found nothing. Any suggestion would be very valuable for me.

Any help?