condorheroblog / vuepress-plugin-export-pdf

VuePress plugin exports PDF 📁.
MIT License
22 stars 2 forks source link

Feature Request - ability to set different pdf options per html page #17

Closed aerialhedgehog closed 9 months ago

aerialhedgehog commented 9 months ago

I am trying to export a document with a title page, so i am trying to omit the header/footer for that page. It looks like the simplest way to do that would be to provide a way to map a route to a pdfoption. Then i could provide a special title page in the route list.

Maybe someone has a suggestion for where to patch in an override instead.

Noting some discussion over at puppeteer on this type of feature, where they specify page ranges mapped to different pdfoptions.
https://github.com/puppeteer/puppeteer/issues/2089

condorheroblog commented 9 months ago

After generating the PDF, open it and directly delete the header and footer of the first page.

It is also a good idea to add configuration parameters for generating PDF to each route, but users still need to hack some code. I think it is not as convenient as directly deleting it using editing software.

Of course, if puppeteer's headerTemplate and footerTemplate are functions or headerTemplate and footerTemplate can execute JavaScript, it will be very simple to implement this function.

It is still not implemented yet and the solution is not perfect enough🙂