-
Notifications
You must be signed in to change notification settings - Fork 24
Description
While discussing at WordCamp Ahmedabad today, we came up with an idea that
perhaps we can have a button on the main page of the slide which would download
a PDF format of the document.
I think this is very much doable and would solve the offline issue. There are three approaches that come to mind.
Manual PDF Linking
Here, author of the repo/slide would create a PDF by simply taking a Print (Save as PDF) and having the button link to the PDF.
pros
- Not much to develop here.
- Will always work and the PDF will be the same, regardless of the browser.
cons
- Overhead of managing the PDF along with HTML.
Automated PDF generation with JS
We can use an Open Source MIT licensed JS library jsPDF to automate the process without
needing a server.
pros
- No extra burden on maintainer.
- Should work on almost all browsers.
cons
- Things are a bit experimental. So could be janky.
- Would work only on the slides page, not on any other page (maybe).
Build time PDF generation
I don't know here how exactly the docs would find their way to publication/website.
But there has to be a build process and I believe it would be powered by node.
So if we have something to work with right now, I think it would be best for me to
try and integrate the PDF generation during the build time.
pros
- Generated automatically during build time with headless chrome. So very consistent.
- Not at all heavy on browsers because it will be afterall another static file.
- Maintainers won't have to think about it because it would happen everytime the site is built.
cons
- Maybe we will need to add/edit existing tooling as mentioned here