Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 1.23 KB

README.md

File metadata and controls

45 lines (37 loc) · 1.23 KB

PDF-report generator in Rust

It is built in Rust using the following crates:

  1. Rocket framework as HTTP Server
  2. Handlebars-rust as template engine
  3. wkhtmltopdf command line tool to generate PDF (not a crate)
  4. Utilities: log, rust-ini, uuid

Application workflow is an synchronous call over HTTP and looks like this:

HTTP Route -> Service -> Template Engine -> wkhtmltopdf - PDF

See report template in templates/book-order-report.html.

Sample JSON request looks like this:

{
  "template_name": "book-order-report",
  "user_params": {
    "customer_name": "Frank Smith",
    "address": "Address: Frankfurt am Main, Mainzer str. 100",
    "ordered_books": [
      {
        "book_name": "Getting Things Done: The Art of Stress-Free Productivity. Authors: David Allen",
        "amount": 9.51
      },
      {
        "book_name": "Funky Business - Talent Makes Capital Dance. Authors: Ridderstråle, Nordström",
        "amount": 14.99
      },
      {
        "book_name": "The Rust Programming Language (Manga Guide). Authors: Klabnik, Nichols",
        "amount": 23.99
      }
    ],
    "total": 48.49
  }
}

See more details at this INNOQ article: https://www.innoq.com/de/blog/rust-report-generator/