What's a good way to deliver printable reports?

This page summarizes the projects mentioned and recommended in the original post on /r/sveltejs

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • jsPDF

    Client-side JavaScript PDF generation for everyone.

  • If you decide to go with PDF, I highly suggest https://github.com/parallax/jsPDF

  • svg2pdf.js

    A javascript-only SVG to PDF conversion utility that runs in the browser. Brought to you by yWorks - the diagramming experts

  • If you need to print to exact dimensions, you MUST use PDF. This was what i needed, so I draw everything to an SVG, and made sure that my units were in "pt" (that is 1px = 1/72inch). When creating the PDF, I specified that the units were in "pt" and used https://github.com/yWorks/svg2pdf.js/ to convert the SVG. Note that this has major disadvantages. SVG does not support word wrap by default; you'll have to write your own. You'll also have to get users to specify a paper size in your app. Again, test, test, test. If you want to preview the PDF, not all browsers can display PDF natively (looking at you Android)! Some browsers won't print exact size even in PDF (Android). Some browsers will reduce page margins if printing from an inline iframe preview (Safari). You need annoying workarounds. Like downloading instead of previewing the file on Android, or making sure to always open a new tab on Safari.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • react-pdf

    📄 Create PDF files using React

  • Recently, we had a requirement for it to be a PDF at my work, and the only good thing we found that could do it in javascript was react-pdf. It doesn't work exactly like react, and it sure ain't Svelte, but it is pretty friendly to create a pdf and relatively fast (generate 10-15 pages in around 2-3s for us, with lots of graphics and charts). And we managed to make it work backend side (in an aws lambda).

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts