Git Product home page Git Product logo

prawn-qrcode's Introduction

Prawn/QRCode: A simple extension to generate and/or render QRCodes for Prawn PDFs

Prawn/QRCode is a Prawn (>= 0.11.1) extension to simplify rendering of QR Codes*.

(*) QR Code is registered trademark of DENSO WAVE INCORPORATED. See http://www.denso-wave.com/qrcode/ for more information.

Install

$ gem install prawn-qrcode

Usage

require 'prawn/qrcode'

qrcode_content = "http://github.com/jabbrwcky/prawn-qrcode"
qrcode = RQRCode::QRCode.new("http://github.com/jabbrwcky/prawn-qrcode", :level=>:h, :size => 5)

# Render a prepared QRCode at he cursor position
# using a default module (e.g. dot) size of 1pt or 1/72 in
Prawn::Document::new do
  render_qr_code(qrcode)
  render_file("qr1.pdf")
end

# Render a code for raw content and a given total code size.
# Renders a QR Code at the cursor position measuring 1 in in width/height.
Prawn::Document::new do
  print_qr_code(qrcode_content, :extent=>72)
  render_file("qr2.pdf")
end

# Render a code for raw content with a given dot size
Prawn::Document::new do
  # Renders a QR Code at he cursor position using a dot (module) size of 2.8/72 in (roughly 1 mm).
  render_qr_code(qrcode_content, :dot=>2.8)
  render_file("qr3.pdf")
end

For a full list of examples, take a look in the examples folder.

Contributors

Changelog

0.1.0

Initial Release

0.1.1

Updated prawn dependency from exact requirement of 0.11.1 to an >=0.11.1, <0.13

0.1.2

Integrated patch to reduce rectangle count, which leads to a overall size reduction of the generated PDF (bdurette)

0.2.0

Integrated patch from bdurette to align QR Code within its bounding box. Adds the optional parameter :align (:left, :center, :right) to both render_qr_code() and print_qr_code()

prawn-qrcode's People

Contributors

jabbrwcky avatar bdurette avatar pjkelly avatar

Watchers

Shanmuga avatar  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.