I’m working on an Angular project where I need to generate certificates for users based on pre-existing PDF templates. The PDFs contain placeholders like ##First Name##
, ##Last Name##
, ##Score##
, etc., which need to be programmatically replaced with actual user data retrieved from the backend.
Currently, I retrieve the PDF as a Blob from the backend and can successfully display it using ng2-pdf-viewer
. However, I need a solution to replace these placeholders with dynamic user data while preserving the original PDF formatting, including text alignment, fonts, and colors.
I’ve tried using pdf-lib
, which allows me to draw new text over the existing PDF content, but this approach doesn’t actually replace the placeholder text; it just prints the new text on top, which isn’t ideal.
Is there a library or method that allows for actual text replacement in a PDF, preserving the original formatting in Angular? I’m looking for a solution that maintains the integrity of the PDF’s design while replacing the placeholders with dynamic data.
1