This solution works best if you're targeting one or a limited selection of products. However, if you have a lot of products needing unique PDF links, it's probably a better idea to look for an app to solve this.

Are you targeting one or multiple products? Does every product being targeted have the same PDF link?

If you're willing to describe your use case for this in detail, the community can point you in the right direction.