Multiple code duplication, use intermediate variables to reduce code
All text messages should use internationalization as in other part of this code, but you have no access to them from here, that's due to bad code structure, use injection of pass it somehow
We have same problems in all functions in this file https://github.com/diia-open-source/be-pkg-utils/blob/main/src/pdfUtils.ts