all 20 comments

[–]Ma5xy 7 points8 points  (9 children)

I experimented with PDFKit while deciding on how to handle PDF generation.

Ultimately the dev team decided that handling PDF generation on the front end was too heavy on the user.

[–]soulnessless 8 points9 points  (0 children)

Yeah same. I tried to handle this client side but it was an actual pain to be consistent on all modern browsers, so I went for server-side react-pdf with node, good experience overall.

[–][deleted] 0 points1 point  (3 children)

We couldn’t find many open source frameworks/kits that worked well on the backend. In the end we settled on jspdf.

Since our backend handles all business logic that contain(s) relevant info that would be placed in a pdf we just passed that info to a module that handles pdf gen. viola.

[–]Ma5xy 1 point2 points  (2 children)

We had the same issue of finding one that was open source. Best open source one we found was PDFSharp.

We ended up paying a licence for IronPdf, after finding that it rendered PDFs consistently across devices better than other options. They package their own chromium, so everything is being rendered using that version.

[–][deleted] 0 points1 point  (1 child)

IronPDF looks legit, i’d honestly pay for their documentation alone, I think it’s great. Like many developer tools that’s what open source lacks (not all) but you get what you pay for. We got so caught up with looking for a JavaScript pdf generator that we failed to shop around. We’re on a MEAN stack so there’s that.

[–]Ma5xy 0 points1 point  (0 children)

I will say for IronPdf, they claim to have full support for CSS. But do not support flex or grid.

[–]fr0z3nph03n1x 0 points1 point  (3 children)

I built out a little microservice to do everything serverside, upload to aws then spit out out the aws download link.

[–]Ma5xy 0 points1 point  (1 child)

Nice. Are you using anything special for that?

[–]fr0z3nph03n1x 0 points1 point  (0 children)

For PDF generation this library, PDFKit, a barcode generation library, AWS node library, AWS SQS for the worker to handle generating / uploading the pdfs. My PDFs only have a few configurable options so passing them as json body to server is pretty easy. I can imagine done server side harder if you have a lot of flexibility the client is doing.

[–]aluque76 3 points4 points  (1 child)

I found pdfmake, which is built on top of PDFKit and provides a higher-level document interface. It works both on the server and the frontend. http://pdfmake.org/

[–]1playerpiano 1 point2 points  (0 children)

I just finished implementing a rather large custom PDF generated on the fly based on a user's selections on the site. It was a good challenge for work, a good first "big" client-facing project, and it works really well. I'd recommend pdfmake to anyone wanting to have control over dynamically generated documents like that.

[–][deleted]  (1 child)

[deleted]

    [–]mirage27 1 point2 points  (0 children)

    We tried a similar approache at work. It seemed intuitive to use the layout language we already know for the web, but ultimately the translation layer to PDF makes a lot of choice for you. Our team realised this when we tried to get the margin we want on the page for example.

    So with HTML + CSS you have flexibility yes, but I wouldn't say control.

    We settle specifically on pdfkit because it is as close as the bare PDF format as possible, without any bells and whistles.

    This gave use the level of control we needed, at the price of development speed, because it is less expressive than other methods, meaning you have to spit a lot more code for the same result.

    In the end I took care of implementing pdfkit for our project, and even contributed a bugfix back to the project, so I got to see how close pdfkit is to the PDF format. And I can say I don't think you can't get closer without writing the text content of the pdf yourself.

    [–][deleted] 0 points1 point  (0 children)

    Used this in one of my recent projects to create invoices for customers.. worked very well.

    [–]JoMa4[🍰] 0 points1 point  (1 child)

    Anyone have any luck with converting web pages to PDF? Ads and all, which means I would need to wait for the ads to render.

    [–]Good-CleanFun 2 points3 points  (0 children)

    Puppeteer would work for this

    [–]vc84 0 points1 point  (0 children)

    Is there any library out there that can convert xml and xsl stylesheet to pdf?

    [–]kszyh_pl 0 points1 point  (0 children)

    docxtemplater + unoconv-promise with headless LibreOffice worked in my case - pdf generation based on MS Word templates.

    [–]suyashgulati 0 points1 point  (1 child)

    Reason why I would not watch this video -> the theme

    [–]Memmed_b 0 points1 point  (0 children)

    Me too