Some ideas about classified documents labeling and QR codes

It is obvious that in order to properly protect something, you first need to know: what you possess and what value it brings to you. This principle also applies to information that – especially today –  in companies of every industry is undoubtedly the driving force of business. As such, like all company assets, the information requires protection by the means and in a manner closely related to the level of classification.

Information resources must therefore be inventoried and classified according to the classification standards applicable to the company. Then they should be protected to prevent leakage of sensitive information to the outside of the company.

But today I don’t want to focus comprehensively on the whole problem, because in this case probably I would have to write a book about it. So I’ll confine my consideration to only one aspect: labeling of classified documents by the best possible way to facilitate their management.

In my opinion, an excellent way of classified documents labeling is to place QR (Quick Response Code) in their headers or footers. Such labels can include not only the classification clause, but also – for example – some information about the owner of the document, the date of its preparation, checksum, its identifier in the database of classified documents  etc. QR Codes can be easily scanned and decoded. You don’t need to have any kind of professional, dedicated scanners. Instead of them you can use your smartphone equipped with such software as for instance QRafter or similar.

How to generate QR codes with the classification clauses?

To develop a pretty elegant solution, there are no great effort and a big budget needed. Your (as always) excellent mind and some basic coding skills will be quite enough.

What I wanted to show now is just a prototype, and therefore does not pretend to be a turnkey solution.  However It can be considered as a sort of springboard (inspiration?) to some more useful ideas and solutions.

Script developed by me, which I put below, was written in Ruby. To build its graphical user interface I used the GTK2 library. To execute it you need of course the Ruby language interpreter. In Linux and MacOS it is installed by default. The best distribution for Windows is available at The script requires the GTK2  and rqrcode_png libraries. Both can be installed very simply by issuing the following commands on the operating systems shell prompt:

gem install gtk2


gem install rqrcode_png

Here is the script code:

# encoding UTF-8
require 'rqrcode_png'
require 'gtk2'

def message_box(message)
   dialog ="Message",
        [ Gtk::Stock::OK, Gtk::Dialog::RESPONSE_NONE ])
   # Dialog box should be destroyed when the user responds.
   dialog.signal_connect('response') { dialog.destroy }

def qr_code_generate (text, resolution, size)
      qr = text, :size =>size, :level => :h )
      png = qr.to_img 
      png.resize(resolution, resolution).save("your_qrcode.png")
      message_box("Your QRcode is saved into the: your_qr_code.png file in the current directory\n")
   rescue => e
      message_box("Problem, problem.... See the details at the console.\n")
      p e.message
      p e.backtrace

window ="QRCodeGen by Janusz Nawrat (2013)")
window.resizable = false
window.border_width = 10
window.signal_connect('destroy') { Gtk.main_quit }
window.set_size_request(350, 450)

frame ="Text to generate QRcode from...")
frame.set_shadow_type( Gtk::SHADOW_ETCHED_OUT )

textview =
textview.buffer.text = "Input your text here..."
textview.set_size_request(-1, 280)

scrolledw =
scrolledw.border_width = 5
scrolledw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS)


action_button ="DO IT NOW")
clear_button ="CLEAR")
cancel_button ="Quit")

action_button.signal_connect('clicked') {
   qr_code_generate(textview.buffer.text, $resolution.value.to_i, $size.value.to_i)
   textview.buffer.text = "\n" + textview.buffer.text
   qrcode_picture ="your_qrcode.png")
   iter = textview.buffer.get_iter_at_line(0)
   textview.buffer.insert_pixbuf(iter, qrcode_picture)

clear_button.signal_connect('clicked') {
   textview.buffer.text = ""

cancel_button.signal_connect('clicked') {

param_frame ="QR Code Resolution")
param_frame.set_shadow_type( Gtk::SHADOW_ETCHED_OUT )

resol_label ="QR Code Resolution: ")
$resolution =, 180, 20)
$resolution.value_pos = Gtk::POS_LEFT

size_frame ="QR Code Size")
size_frame.set_shadow_type( Gtk::SHADOW_ETCHED_OUT )
size_label ="QR Code Size: ")
$size =, 20, 1)

hbox =, 1)
hbox.pack_start(action_button, true, true, 0)
hbox.pack_start(clear_button, true, true, 0)
hbox.pack_start(cancel_button, true, true, 0)

param_hbox =, 1)
param_hbox.pack_start(resol_label, true, true, 0)
param_hbox.pack_start($resolution, true, true, 0)

size_hbox =, 1)
size_hbox.pack_start(size_label, true, true, 0)
size_hbox.pack_start($size, true, true, 0)

vbox =, 1)
vbox.pack_start(frame, true, true, 0)
vbox.pack_start(param_frame, true, true, 0)
vbox.pack_start(size_frame, true, true, 0)
vbox.pack_start(hbox, false, false, 0)


…and the screenshot:


I mentioned earlier about more useful applications of QR codes. I can easily imagine that a little development made on printer driver or spooler scripting code could allow us to generate such codes fully automatically and transparently to the user. However, before you start experimenting, remember that we cannot do these experiments in production environments and every solution before its production implementation  must be reliable and thoroughly tested to let the business function properly, without unnecessary interruptions.

I hope I was able to inspire you a little bit.

Thank you for your attention and wait for the next article on my blog!


Informacje Janusz Nawrat
Just ordinary man who likes thinking...


Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:


Komentujesz korzystając z konta Wyloguj / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Wyloguj / Zmień )

Zdjęcie na Facebooku

Komentujesz korzystając z konta Facebook. Wyloguj / Zmień )

Zdjęcie na Google+

Komentujesz korzystając z konta Google+. Wyloguj / Zmień )

Connecting to %s

Tomasz Welna

visual artist / filmmaker


Szkoła Rysunku Malarstwa i Grafiki DR TOMASZA WEŁNY | KRAKÓW | Plac Matejki 10 | tel 691 81 75 74

Piękno neurobiologii

Blog Jerzego Vetulaniego

Teoria muzyki, zasady muzyki, podstawy muzyki

Teoria muzyki, zasady muzyki, podstawy muzyki - czyli to co każdy amator muzyki wiedzieć powinien :)

Personal Development & Inspirations

Przemyślenia i refleksje, którymi warto się podzielić (blog by Janusz Nawrat)

Business IT Cooperation Platform

Biznes i IT - dwa światy, które muszą współdziałać

%d blogerów lubi to: