Coder Social home page Coder Social logo

csv2qr's Introduction

csv2qr

Background

My friend told me that they needed to generate some QR codes. Naturally I wrote them a command line tool in Rust.

Prerequisites

Install cargo with rustup. Then just install csv2qr with cargo install csv2qr. rustup should have setup your PATH correctly but on Windows you might have to reboot or something. IDK, I don't use Windows.

Usage

Usage is meant to be pretty self explanatory and csv2qr includes command line help. The only argument that you need to specify is a CSV file where the first column is a "title" and the second column is the value to encode into the QR. There is an example file here.

$ csv2qr -h
csv2qr 0.2.0

A simple command line tool for generating QR codes from a CSV file.

USAGE:
    csv2qr [OPTIONS] <CSV_PATH> [OUTPUT_PATH]

ARGS:
    <CSV_PATH>       CSV file to parse
    <OUTPUT_PATH>    Output directory [default: .]

OPTIONS:
    -d, --debug                Turn on debug output
        --ecc <ECC>            ECC level (low, medium, quartile, or high) [default: medium]
    -h, --help                 Print help information
    -n, --no-pdf               Do not generate the final PDF document, only the intermediate PNG.
                               This will enable save-intermediate automatically
    -s, --save-intermediate    Do not delete the intermediate PNG of the QR code
    -V, --version              Print version information

csv2qr will created a PDF with the titled/labeled QR code for each row in the CSV. Eg,

$ mkdir /tmp/csv2qr
$ csv2qr example/example.csv /tmp/csv2qr
$ ls -l /tmp/csv2qr
total 7856
-rw-rw-r-- 1 myuser myuser 2008838 Oct 20 17:35 Hack_the_planet.pdf
-rw-rw-r-- 1 myuser myuser 2009061 Oct 20 17:35 I_am_not_a_martyr_I%27m_a_problem.pdf
-rw-rw-r-- 1 myuser myuser 2008905 Oct 20 17:35 Prodigy_-_Mind_Fields.pdf
-rw-rw-r-- 1 myuser myuser 2008892 Oct 20 17:35 This_is_what_I_do.pdf

Special thanks

This is just some simple glue code that stitched other Rust crates together. The real magic happens in the genpdf and qrcode-generator crates. Tests were made possible by the bardecoder and image crates. I also included the Calling Code font from the source code of the text-to-png crate.

To the best of my knowledge it's all pure Rust. I have tested with Rust 1.66.1 on Kubuntu 22.04 and Rust 1.73.0 on Windows 10. It will probably run on other platforms too.

csv2qr's People

Contributors

taborkelly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.