PDF generation with JavaScript

Creating PDFs from webcontent is a common use case in the RIA (Rich Internet Application) world. For example you can create a download of a bill in a billing system or create an instance of a predefined template enriched with data from the webpage. If you need to create a PDF you have two choices: - Generate the PDF in the backend of your RIA application, for example in Java. - Generate the PDF in the frontend for example in plain Javascript, AngularJS or Angular2-5. So, whats the advantaces and disadvantages of these two approaches?