WKHTMLTOPDF: How to disable header on the first page

后端 未结 5 1573
终归单人心
终归单人心 2021-02-06 03:39

wkhtml doesn´t repeat table elements \"th\" on every page like it should. So I thought it could be possible to simply use the --header-html option and add the table headers manu

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-06 04:21

    I faced similar problem in which I had used WKHTMLTOPDF header/footer and I wanted to remove them from the cover page. The issue was that the maximum height of header/footer was still appearing on all pages including the cover page.

    The solution that clicked my mind and saved the day was that I generated two WKHTMLTOPDF files, one with header/footer on all pages and the other one without any header/footer. I then picked cover page from WKHTMLTOPDF generated file without header/footer and rest of the pages from the other WKHTMLTOPDF generated file with header/footer on all pages. I used PDF Merger library in PHP to merge selected pages of two WKHTMLTOPDF generated 'PDF' files to generate single PDF file with cover page and header/footer on rest of the pages.

提交回复
热议问题