I use multiple tables in my pdf function. and I tried using didDrawPage() hook to add the header and the footer. But when using that method it gets weird since multiple tables draw the image multiple times in the header. Then I created a seperate function to make the header and the footer and used startY to add the top margin to the tables. But I have a table that consist of images and want that table to split into different pages when overflowing. Splitting part works fine. But since im not using didDrawPage function the table that is generated in the next page starts at top and overlaps with the header.
Is there a way to add a margin to the top of the generated table on the next page. I feel like this can be achieved with didDrawPage hook but I dont want to make the header inside didDrawPage method, just want to add a margin on top when a new page is created. Any help is much appreciated
I've faced the same issue recently and got it fixed using the didDrawPage hook.
const options = {
...otherOptions,
didDrawPage : (data) => {
data.settings.margin.top = headerHeightValue;
}}
Hope this helps. : )