How to get repeating column headers using HTML2PDF?

Question:

I have HTML with a table that when converted to PDF gets split over multiple pages, but the table column headers are not repeated at the top of each page. How to get the column headers to repeat at the top of each page?

Answer:

This behaviour is controlled by whether Landscape or Portrait page orientation is selected. For repeating table column headers you need to select Portrait mode using the code below.

html2pdf.SetLandscape(false);