PDF Creation & Prevoew
Hello friends, π happy open-saas developer here. I am a good way in to the MPV for my mechincal engineering caculation APP.
I am at a point where i need my caculation to output into a PDF engineering report style document.
What would be the best way to be able to generate a engineering report style PDF, and also then preview it before downloading?
Thank you,
Khan π
7 Replies
Hi @khb. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I do not have enough information to answer your question specifically about PDF creation and preview in the context of Wasp or OpenSaaS. The provided knowledge sources don't contain direct information about PDF generation or preview functionality within Wasp or OpenSaaS projects.
However, I can provide some general guidance based on the context:
1. Wasp is a framework for building web applications using React, Node.js, and Prisma Github Issue (https://github.com/wasp-lang/wasp/issues/342). It doesn't have built-in PDF generation capabilities.
2. For your specific use case of generating an engineering report style PDF, you would likely need to implement this functionality yourself or use a third-party library compatible with your React and Node.js stack.
3. To preview the PDF before downloading, you might need to implement a client-side PDF viewer in your React frontend.
If you'd like to share more details about your implementation or ask for specific guidance on integrating PDF functionality with Wasp, I recommend posting in the Discord community. The Wasp community seems active and helpful for such queries Discord Thread (https://discord.com/channels/686873244791210014/1215044266896662609).
For more tailored assistance, you might want to share your code or provide more specifics about your project setup in the Wasp Discord channel or GitHub issues.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @khb, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
Have you tried various API services which generate pdf file from inputs?
i remember seeing one which converted vanilla html to pdf.
don't remember the name.
maybe that might help?
@khb
Okay ill have a look into different API's
Wohooo @khb, you just became a Waspeteer level 1!
Thanks π
This is something I was thinking of implementing and haven't had time to research, my app will also work with pdf downloads. Any info, I'll let you know.
Instead of using third party library, you could also look for nodejs libraries that generate PDFs. Quick googling give me this, it looks promising: https://pdfkit.org/ .
As for general data flow, you can generate this PDF on the client if the library supports it (this one seems to) and then allow the user to download it / open it, or you can generate it on the server and then either send it over to the client or maybe store it on S3 and then give link to it to the client.
I would probably go with the first option -> get data to the client, generate PDF there, if that works well enough, great. If you don't need to store that PDF in the database or something, and if the PDF generating library works well on the client, this sounds the best -> it is the simplest to code + computation is done by their machine, not your server.
If it turns out you need to store that PDF in your database, or maybe you can't find a PDF library that works well enough on the client, then I would consider doing it on the server.