![]() ![]() It is possible to generate a PDF file both on the client-side and on the server-side. Final option 3: Puppeteer, headless Chrome with Node.jsĬlient side or Server side PDF generation?.Option 1: Making a Screenshot from the DOM.Client side or Backend side PDF generation?.This blogpost will walk you through on these possibilities and the final implementations.Ī personal comment before we get started: it’s quite a hassle, so buckle up! Table of Contents: So the PDF should have different styling and additions compared to the original React page.Īs the assignment was a bit more complex than what could have been solved with simple CSS rules, we first explored possible implementations. ![]() Furthermore, there were some special requests to manipulate the layout and make some rearrangements of the HTML elements. That page is basically a report/result for patients with data visualization, containing a lot of SVGs. Node.js is free of locks, so there's no chance to dead-lock any process., headless Chrome & Docker.īackground: A few months ago one of the clients of RisingStack asked us to develop a feature where the user would be able to request a React page in PDF format. In this article I’m going to show how you can generate a Puppeteer PDF document from a heavily styled React web page using Node.js Node.js is an asynchronous event-driven JavaScript runtime and is the most effective when building scalable network applications. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |