How to use each loop in header pdf util
I have candidate array and need data from each candidates in header pdf util. How can I achieve that?
I have tried below technique, this is the right way to do this? because I need more data in header so Do I need to create functions each time?
Can you suggest any other option for the same?
I have tried each loop in header file but it is not working as expected.
it looks your code is the right way, there are multiple ways you can simplify it, one way is that instead of adding pdf page item per property value, you just use a single call with all the properties. then in the header you are sure your data is in the 0 index, and can create just a single function for all your properties access.
if you need to conditionally render something based on the avatar you can still do it in the header, from the main you can just propagate the avatar value (without the if) no matter if it is undefined or not
here is a demo