pdf.lib.php

In pdf file i needed to extra features in source company address ( e.g. adding prof ID1, MAIN_PROFID1_IN_ADDRESS only works for target company).
I did what i want by changing pdf.lib.php but I have to redo again with every new update of version.
Is there any other way e.g. extend the module. Any leads will be helpful.

I think, I can do using hook. Thanks