Git Product home page Git Product logo

rqrcode_to_svg's Introduction

Depreciated!

Newer versions of the rqrcode gem have native svg output, rendering this obsolete.

RQRCode to SVG

Generate QR Codes as vector graphics. This package adds a to_svg method to the excellent rqrcode gem. It's pure Ruby, with no outside dependencies on heavier image manipulation or XML tools like RMagick or Nokogiri.

Installation

gem install rqrcode_to_svg

Usage

Start by creating an RQRCode::QRCode object as supplied by rqrcode.

qr = RQRCode::QRCode.new("http://www.google.com", :size => 4, :level => 'h')

An SVG is just one step away.

qr.to_svg

Without any options, this will return a string of the SVG's XML.

But there are many options.

qr.to_svg(:file => 'test.svg', :px => 4, :border => true, :namespace => false, :indent => false)
  • :file will write the SVG out to a file and return the path.
  • :px increases the size of each code-point by the given number of pixels-per-side-of-the-square. Defaults to 4.
  • :border toggles the border around the QR code. Defaults to false.
  • :namespace toggles use of the XML namespace prefix within the SVG. Defaults to false.
  • :indent toggles the pretty printing of the SVG's internal XML. Defaults to tag soup at false.

All options optional. Check out the documentation within the code for additional tweaks.

rqrcode_to_svg's People

Stargazers

Andy Selvig avatar Oleksii Leonov avatar 大野 avatar David W. Allen avatar Zheng-Yu Chen avatar

Watchers

Jon Jensen 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.