PDF Editor to replace certain Elements (SAP / JavaScript)

I got the task to create an SAP UI5 Fiori application where you can upload a pdf file and where the application automatically blacks out personal information like the name or the phone number. Or if this is not working, at least black it out by yourself through an editor function. Therefore i need to be able to have access to the text from the pdf file.

I tried to solve this via base64 encoding and i was hoping that i can simply replace the base64 string of for example “John Smith” with the encoded string of “****”. But these strings are not found in the pdf or img encoded base64 string. I could extract the text from the pdf file and replace it there but the task says that the layout and design of the given pdf file should stay the same.

So since the base64 attempt doesnt seem to work i need to build my own pdf editor. The given PDF viewer of SAP lets me view the pdf but not edit it in any way. The same seems to be the case for pdf.js since there are no tutorials on how to build an actual editor with it.

The only tutorials that i could find were some short explanations about the code, but the code itselfs lies behind a $100 paywall..

So what would be the best way to solve this task and build pdf editor?

If things are unclear or need further explanation, let me know!