Resolve "PDF Export of report data" (#122)
Notes
PDF design
For this issue, I left the design of the PDF itself very basic, I think it would be good to put that into another issue, as producing the pdf itself could proved to be quite complicated, handling such things as line breaks, and different question types. I left a TODO note with a few things that should be considered.
PDF library
I used pdf-lib as the PDF library. One of the dependencies of which is a commonjs module which produces a warning from angular as they can be badly optimised.
Including this library increased the bundle size by a considerable amount (I think main.js went up from ~2.6 - 3.3, I can't remember the exact numbers), however the bundle size was quite big to begin with. We should think at some point about optimizing the bundle size
I think it would be possible in this case to use lazy loading to only load the pdf library when it's actually needed, I tried to do this but wasn't successful. Possibly someone else has more experience on lazy loading services, but if not we could come back to it in the future.
Download
I couldn't get the old download function to work as it was written, but I'm not sure why exactly it wasn't working. Examples I saw of this being used used Blob(
to create the download href, so I used that here to, and it works as well for the json download. I'm not sure if this will affect #123
Closes #122 (closed)