zhaoterryy / mkdocs-pdf-export-plugin

An MkDocs plugin to export content pages as PDF files
MIT License
313 stars 44 forks source link

feat: Ability to modify HTML before PDF generation #35

Open estan opened 5 years ago

estan commented 5 years ago

It would be great if there was a function in the theme handler in which I could modify the HTML before it's converted to PDF, for example to add a title page.

(At the moment, I tried to add a title page by combining the output with a pre-made PDF for the title page using Ghostscript, but the problem is that Ghostscript ruins all the named destinations links, so internal links won't work. Would be better if I could just insert some HTML for the title page and style it with CSS)

zhaoterryy commented 5 years ago

That would be 💯 great. Going to give the same reply from #29:

Shouldn't be hard to fix. If you need this urgently I would suggest making a PR - otherwise you'll have to wait a bit.

sander76 commented 5 years ago

You will get far doing a dedicated css regarding print styling. That's how I am planning to do this.

estan commented 5 years ago

Yep. I would like the content (eg title, author, version etc) that should go on the title page to be in HTML though.

sander76 commented 5 years ago

But then you don't need to change html

estan commented 5 years ago

I know, but I want it in HTML because it makes sense semantically for it to be there (since it is content). And I want to take the title from the site_name in mkdocs.yml, so I was thinking that the new callback could have access to that.

Anyway, I may go with your approach in the meantime.

sebastienlevert commented 5 years ago

I would really like to help/comment on this issue. Is there anything in progress right now? How can we help on building this? We are looking at adding a TOC and a Cover page to our generated output and this definitely seems the way to go! Thanks!