C
C#2y ago
reeeeeee

❔ Convert cshtml view to PDF file

Basically title. I had this functionality working already, but its working weirdly slow sometimes... its also probably not the best, because I am geenrating it with Puppeteer, so technically I am opening the html content in the hidden browser, and then downloading it from there. What would be the best free option to do this?
7 Replies
Pobiega
Pobiega2y ago
Rendering it with a browser and doing "print to pdf" is probably the easiest, and thats exactly what puppeteer does.
reeeeeee
reeeeeeeOP2y ago
yeah i know, but for some reasong it doesnt work consistently.. sometimes it reneders it instantly, and sometimes loads for like 30sec, or doesnt even render it at all..
Pobiega
Pobiega2y ago
Curious. I wrote something very similar using a .NET webapi that could just wrap a puppeteer script to generate PDFs, and unless the page had a lot of funky JS it worked fine
reeeeeee
reeeeeeeOP2y ago
Hm, i dont have any JS, so technically it should for perfect.. I will turn off the headless mode, maybe i will figure something out
Pobiega
Pobiega2y ago
¯\_(ツ)_/¯ its hard to debug, that is one of the downsides
Angius
Angius2y ago
*cough* QuestPDF *cough*
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server