reportlab-qr-code-generator


Namereportlab-qr-code-generator JSON
Version 1.7.0 PyPI version JSON
download
home_page
SummaryQR code plugin for reportlab and RML language
upload_time2023-05-28 10:26:19
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT
keywords qr code rml reportlab
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========================================
QR code plugin for reportlab RML language
=========================================

|codecov| |version| |downloads| |license|

Install
-------

.. code:: bash

	pip install reportlab_qr_code_generator

Example output
--------------

.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/custom_style.png?v2023-05-28

Why is this better than x?
--------------------------

**Including image to PDF**

Images are blurry.

**reportlab-qrcode**

Reportlab qrcode is vector QR code generator for reportlab. My project is better
in some aspects:

Images can be directly added to Reportlab RML code.

Better rendering:

.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/rendering.png?v2022-10-02

This library merges adjacent blocks to single area whihch produces image without
gaps in every situation.

Smaller output

First paragraph of Lorem ipsum products using reportlab-qrcode vector image with
size 181 418 bytes.  My code with produces only 34 131 bytes (81% reduction in
size).

Customizable colors

Usage
-----

This package allows insert QR codes to reportlab document.

This package can be used directly from reportlab RML file or from python code.

RML
^^^

To insert QR code from rml file use this code:

.. code:: xml

	<plugInGraphic module="reportlab_qr_code" function="qr">parameters;format;contents</plugInGraphic>


Parameters is key=value list delimited using ',' character, e.g.
``size=10cm,padding=1cm``.

Format is either 'text' or 'base64' for simple text and base64 encoding. QR code
contents is after second semicolon.

Complete example:

.. code:: xml

	<illustration height="5cm" width="5cm" align="center">
		<plugInGraphic module="reportlab_qr_code" function="qr">size=5cm,padding=0.5cm;text;Simple text</plugInGraphic>
	</illustration>

Python API
^^^^^^^^^^

QR code can be inserted to canvas using ``qr_draw(canvas, contents, **params)`` function.

.. code:: python

	from reportlab.pdfgen import canvas
	from reportlab_qr_code import qr_draw

	c = canvas.Canvas("out.pdf")
	qr_draw(c, "Hello world", x="1cm", y="1cm", size="10cm")

Command line interface
^^^^^^^^^^^^^^^^^^^^^^

This module can be used as standalone command to generate PDF document.

Example:

.. code:: bash

	python -m reportlab_qr_code "Content" --outfile qr.pdf

Content argument is optional. Without this argument, command will read from
stdin. Output file is optional too, without argument, command will write to
stdout.

Arguments:

--outfile             Output file or stdout if omitted
--base64              Base64 encoded text
--compress            PDF compression (default enabled)
--no-compress         Disable compression
--version             QR code version
--error_correction    Error correction strength (L, M, Q or H)
--size                Code size (e.g. 10cm)
--padding             Padding around code (e.g. 1cm or 1 for one pixel or 5%)
--fg                  Foreground color
--bg                  Background color
--invert              Invert
--negative            Instead of invert bits, inverts whole image
--radius              Round code (radius)
--enhanced-path       Enhanced path rendering
--no-enhanced-path    Disable path enhancement
--gradient            Either ``"linear x1 y1 x2 y2 colors"`` or ``"radial x y radius colors"`` Dimensions are in range (0, 1), position (0, 0) is top left corner, (1, 1) is bottom right corner. Colors is list ``"[position] color"`` e.g. ``"0.0 #ffffff 1.0 #000000"``. Position is optional. Without position argument, distances are calculated automatically. Example: ``--gradient "linear 0.0 0.0 0.1 1.0 0.5 \#1050c0 0.3 \#1050c0 0.7 \#e0e000"``
--hole                Coordinates in form ``x:y:w:h``. Allowed are absolute length units, relative units (%) and pixels (without unit suffix).
--draw                Select area to draw. Possuble values are: ``'all'``, ``'eye[1-3]'``, ``'eyes'``, ``'eyepupil[1-3]'``, ``'eyepupils'``, ``'eyeball[1-3]'``, ``'eyeballs'``, ``'align'``, ``'alignpupils'``, ``'alignballs'``. It's possible to combine operations with +/- symbol e.g. all-eyes-align. To show only eye1 and eye3 without pupil it's possible to write something like ``eye1+eye3-eyepupil3``. Arguments passed before first draw are globally set. Arguments after draw are specific for preceding draw call.

Some crazy examples:

.. code:: bash

	# 1
	python -m reportlab_qr_code "Padding 1cm" \
		--outfile qr.pdf \
		--error_correction L \
		--size 10cm \
		--padding 1cm \
		--radius 0.5 \
		--enhanced-path \
		--gradient "linear 0 1 1 0 0.1 \#ff0000 0.9 \#0000ff"
	# 2
	python -m reportlab_qr_code "Padding 1cm" \
		--outfile qr.pdf \
		--error_correction L \
		--size 10cm \
		--padding 1cm \
		--radius 3.5 \
		--gradient "linear 1 0 0 1 0.1 \#ff0000 0.9 \#0000ff"
	# 3
	python -m reportlab_qr_code "OPENSOURCE" \
		--outfile qr.pdf \
		--size 10cm \
		--padding 1cm \
		--radius 1.5 \
		--bg "\#ddddcc" \
		--fg="\#665510"
	# 4
	python -m reportlab_qr_code "Padding 1cm" \
		--outfile qr.pdf \
		--error_correction L \
		--size 10cm \
		--padding 1cm \
		--radius 3.5 \
		--enhanced-path \
		--gradient "linear 0 1 1 0 0.1 \#ff0000 0.9 \#0000ff"

.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/crazy.png?v2022-10-09

Parameter list
^^^^^^^^^^^^^^

.. list-table:: Parameters
	:header-rows: 1

	* - Name
	  - Default
	  - Description
	* - ``size``
	  - 5cm
	  - size of code
	* - ``padding``
	  - 2.5
	  - padding size, without any unit this meanss 2.5 QR code pixels, it can be
	    absolute value (like 1cm) or relative value (10%)
	* - ``fg``
	  - black
	  - foreground color
	* - ``bg``
	  - transparent
	  - background color
	* - ``invert``
	  - False
	  - invert pixel values
	* - ``mask``
	  - False
	  - render only mask
	* - ``negative``
	  - False
	  - render negative of code
	* - ``version``
	  - 1
	  - version passed to qr code library
	* - ``error_correction``
	  - 'L'
	  - error_correction passed to qr code library (can be L, M, Q or H)
	* - ``x``
	  - 0
	  - x offset
	* - ``y``
	  - 0
	  - y offset
	* - ``hole``
	  - []
	  - list of holes in form ``x:y:w:h…`` (can be repeated)
	* - ``draw``
	  - +all
	  - select elements to draw. Prefix + (plus) means include, - (minus)
	    exclude. Allowed options are: ``'all'``, ``'eye[1-3]'``, ``'eyes'``,
	    ``'eyepupil[1-3]'``, ``'eyepupils'``, ``'eyeball[1-3]'``, ``'eyeballs'``,
	    ``'align'``, ``'alignpupils'`` and ``'alignballs'``

Examples
--------

Python examle:

.. code:: python

	from reportlab.pdfgen import canvas
	from reportlab_qr_code import qr_draw

	def main():
		c = canvas.Canvas("py.pdf")
		qr_draw(c, "Hello world", x="1cm", y="1cm", size="19cm", bg="#eeeeee")
		c.showPage()
		c.save()

	if __name__ == "__main__":
		main()

RML document example:

.. code:: xml

	<!DOCTYPE document SYSTEM "rml_1_0.dtd" [
	<!ENTITY lines5 "
		0cm 0cm 0cm 0.5cm
		0cm 0cm 0.5cm 0cm
		5cm 0cm 4.5cm 0cm
		5cm 0cm 5cm 0.5cm
		0cm 5cm 0.5cm 5cm
		0cm 5cm 0cm 4.5cm
		5cm 5cm 5cm 4.5cm
		5cm 5cm 4.5cm 5cm
	">
	<!ENTITY lines3 "
		0cm 0cm 0cm 0.5cm
		0cm 0cm 0.5cm 0cm
		3cm 0cm 2.5cm 0cm
		3cm 0cm 3cm 0.5cm
		0cm 3cm 0.5cm 3cm
		0cm 3cm 0cm 2.5cm
		3cm 3cm 3cm 2.5cm
		3cm 3cm 2.5cm 3cm
	">
	]>
	<document filename="test.pdf" invariant="1" compression="1">
	<template>
		<pageTemplate id="main" pagesize="17cm,39cm">
			<frame id="main" x1="0.5cm" y1="0.0cm" width="5cm" height="39cm"/>
			<frame id="main" x1="6cm" y1="0.0cm" width="5cm" height="39cm"/>
			<frame id="main" x1="11.5cm" y1="0.0cm" width="5cm" height="39cm"/>
		</pageTemplate>
	</template>
	<stylesheet>
		<paraStyle name="Normal" fontSize="12" leading="16" spaceBefore="16" />
	</stylesheet>
	<story>
	
		<para style="Normal">Simple text </para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">;text;Simple text</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Custom size</para>
		<illustration height="3cm" width="3cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">size=3cm;text;Custom size</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines3;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Base 64 encoded</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">;base64;QmFzZSA2NCBlbmNvZGVk</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Custom colors</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">bg=#eeeeee,fg=#a00000;text;Custom colors</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Padding 20%</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">padding=20%;text;Padding 20%</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Padding 1cm</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">padding=1cm;text;Padding 1cm</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Padding 1 pixel</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">padding=1;text;Padding 1 pixel</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Error correction M</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">error_correction=M;text;Error correction</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Error correction L</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">error_correction=L;text;Error correction</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Version 10</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">version=10;text;Version 10</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para style="Normal">Small radius</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">radius=0.5;text;Small radius</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para style="Normal">Round with better path</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">radius=0.5,enhanced_path=1;text;ROUND WITH BETTER PATH</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para style="Normal">Large radius</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">radius=3.5;text;Large radius</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Inverted</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic baseDir="." module="utils" function="gradient" />
			<plugInGraphic module="reportlab_qr_code" function="qr">padding=0,fg=#ffffff,invert=1;text;Inverted</plugInGraphic>
			<lineMode width="2" />
			<stroke color="#ffffff" />
			<rect x="0" y="0" width="5cm" height="5cm" fill="0" stroke="1" />
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para>Mask</para>
		<illustration height="5cm" width="5cm" align="center">
			<lineMode width="0.5" /><lines>&lines5;</lines>
			<plugInGraphic module="reportlab_qr_code" function="qr">mask=1,radius=0.5,enhanced_path=1;text;Mask</plugInGraphic>
			<plugInGraphic baseDir="." module="utils" function="gradient" />
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para style="Normal">Hole</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">hole=20%:40%:60%:20%,error_correction=H,radius=0.3,enhanced_path=1;text;Hole inside QR code</plugInGraphic>
			<setFont name="Helvetica" size="18"/>
			<drawString x="1.8cm" y="2.35cm">Logo</drawString>
			<lineMode width="0.5" /><lines>&lines5;</lines>
		</illustration>
	
		<condPageBreak height="7cm"/>
	
		<para style="Normal">Logo</para>
		<illustration height="5cm" width="5cm" align="center">
			<plugInGraphic module="reportlab_qr_code" function="qr">padding=2,radius=0.5,hole=35%:35%:30%:30%,fg=#554488,error_correction=H,draw=all-align-eyes,draw=alignpupils,radius=0.25,draw=alignballs,fg=#e24329,radius=1,draw=eyeball2+eyeball3,radius=3.5,fg=#fca326,draw=eyeball1,radius=3.5,fg=#e24329,draw=eyepupils,fg=#44366d,radius=3.5;text;https://about.gitlab.com/</plugInGraphic>
			<lineMode width="0.5" /><lines>&lines5;</lines>
			<image file="gitlab.svg" x="1.8cm" y="1.8cm" width="1.4cm" height="1.4cm"/>
		</illustration>
	</story>
	</document>

Output:

.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/codes.png?v2023-05-28


.. |codecov| image:: https://codecov.io/gh/mireq/reportlab-qr-code/branch/master/graph/badge.svg?token=QGY5B5X0F3
	:target: https://codecov.io/gh/mireq/reportlab-qr-code

.. |version| image:: https://badge.fury.io/py/reportlab-qr-code-generator.svg
	:target: https://pypi.python.org/pypi/reportlab-qr-code-generator/

.. |downloads| image:: https://img.shields.io/pypi/dw/reportlab-qr-code-generator.svg
	:target: https://pypi.python.org/pypi/reportlab-qr-code-generator/

.. |license| image:: https://img.shields.io/pypi/l/reportlab-qr-code-generator.svg
	:target: https://pypi.python.org/pypi/reportlab-qr-code-generator/

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "reportlab-qr-code-generator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "qr code,rml,reportlab",
    "author": "",
    "author_email": "Miroslav Bend\u00edk <miroslav.bendik@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/50/f3/75e30ea5ef5fcce0a3e812c1ea0de73e4c80cfd78fcff135404fab488692/reportlab_qr_code_generator-1.7.0.tar.gz",
    "platform": null,
    "description": "=========================================\nQR code plugin for reportlab RML language\n=========================================\n\n|codecov| |version| |downloads| |license|\n\nInstall\n-------\n\n.. code:: bash\n\n\tpip install reportlab_qr_code_generator\n\nExample output\n--------------\n\n.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/custom_style.png?v2023-05-28\n\nWhy is this better than x?\n--------------------------\n\n**Including image to PDF**\n\nImages are blurry.\n\n**reportlab-qrcode**\n\nReportlab qrcode is vector QR code generator for reportlab. My project is better\nin some aspects:\n\nImages can be directly added to Reportlab RML code.\n\nBetter rendering:\n\n.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/rendering.png?v2022-10-02\n\nThis library merges adjacent blocks to single area whihch produces image without\ngaps in every situation.\n\nSmaller output\n\nFirst paragraph of Lorem ipsum products using reportlab-qrcode vector image with\nsize 181\u00a0418 bytes.  My code with produces only 34\u00a0131 bytes (81% reduction in\nsize).\n\nCustomizable colors\n\nUsage\n-----\n\nThis package allows insert QR codes to reportlab document.\n\nThis package can be used directly from reportlab RML file or from python code.\n\nRML\n^^^\n\nTo insert QR code from rml file use this code:\n\n.. code:: xml\n\n\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">parameters;format;contents</plugInGraphic>\n\n\nParameters is key=value list delimited using ',' character, e.g.\n``size=10cm,padding=1cm``.\n\nFormat is either 'text' or 'base64' for simple text and base64 encoding. QR code\ncontents is after second semicolon.\n\nComplete example:\n\n.. code:: xml\n\n\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">size=5cm,padding=0.5cm;text;Simple text</plugInGraphic>\n\t</illustration>\n\nPython API\n^^^^^^^^^^\n\nQR code can be inserted to canvas using ``qr_draw(canvas, contents, **params)`` function.\n\n.. code:: python\n\n\tfrom reportlab.pdfgen import canvas\n\tfrom reportlab_qr_code import qr_draw\n\n\tc = canvas.Canvas(\"out.pdf\")\n\tqr_draw(c, \"Hello world\", x=\"1cm\", y=\"1cm\", size=\"10cm\")\n\nCommand line interface\n^^^^^^^^^^^^^^^^^^^^^^\n\nThis module can be used as standalone command to generate PDF document.\n\nExample:\n\n.. code:: bash\n\n\tpython -m reportlab_qr_code \"Content\" --outfile qr.pdf\n\nContent argument is optional. Without this argument, command will read from\nstdin. Output file is optional too, without argument, command will write to\nstdout.\n\nArguments:\n\n--outfile             Output file or stdout if omitted\n--base64              Base64 encoded text\n--compress            PDF compression (default enabled)\n--no-compress         Disable compression\n--version             QR code version\n--error_correction    Error correction strength (L, M, Q or H)\n--size                Code size (e.g. 10cm)\n--padding             Padding around code (e.g. 1cm or 1 for one pixel or 5%)\n--fg                  Foreground color\n--bg                  Background color\n--invert              Invert\n--negative            Instead of invert bits, inverts whole image\n--radius              Round code (radius)\n--enhanced-path       Enhanced path rendering\n--no-enhanced-path    Disable path enhancement\n--gradient            Either ``\"linear x1 y1 x2 y2 colors\"`` or ``\"radial x y radius colors\"`` Dimensions are in range (0, 1), position (0, 0) is top left corner, (1, 1) is bottom right corner. Colors is list ``\"[position] color\"`` e.g. ``\"0.0 #ffffff 1.0 #000000\"``. Position is optional. Without position argument, distances are calculated automatically. Example: ``--gradient \"linear 0.0 0.0 0.1 1.0 0.5 \\#1050c0 0.3 \\#1050c0 0.7 \\#e0e000\"``\n--hole                Coordinates in form ``x:y:w:h``. Allowed are absolute length units, relative units (%) and pixels (without unit suffix).\n--draw                Select area to draw. Possuble values are: ``'all'``, ``'eye[1-3]'``, ``'eyes'``, ``'eyepupil[1-3]'``, ``'eyepupils'``, ``'eyeball[1-3]'``, ``'eyeballs'``, ``'align'``, ``'alignpupils'``, ``'alignballs'``. It's possible to combine operations with +/- symbol e.g. all-eyes-align. To show only eye1 and eye3 without pupil it's possible to write something like ``eye1+eye3-eyepupil3``. Arguments passed before first draw are globally set. Arguments after draw are specific for preceding draw call.\n\nSome crazy examples:\n\n.. code:: bash\n\n\t# 1\n\tpython -m reportlab_qr_code \"Padding 1cm\" \\\n\t\t--outfile qr.pdf \\\n\t\t--error_correction L \\\n\t\t--size 10cm \\\n\t\t--padding 1cm \\\n\t\t--radius 0.5 \\\n\t\t--enhanced-path \\\n\t\t--gradient \"linear 0 1 1 0 0.1 \\#ff0000 0.9 \\#0000ff\"\n\t# 2\n\tpython -m reportlab_qr_code \"Padding 1cm\" \\\n\t\t--outfile qr.pdf \\\n\t\t--error_correction L \\\n\t\t--size 10cm \\\n\t\t--padding 1cm \\\n\t\t--radius 3.5 \\\n\t\t--gradient \"linear 1 0 0 1 0.1 \\#ff0000 0.9 \\#0000ff\"\n\t# 3\n\tpython -m reportlab_qr_code \"OPENSOURCE\" \\\n\t\t--outfile qr.pdf \\\n\t\t--size 10cm \\\n\t\t--padding 1cm \\\n\t\t--radius 1.5 \\\n\t\t--bg \"\\#ddddcc\" \\\n\t\t--fg=\"\\#665510\"\n\t# 4\n\tpython -m reportlab_qr_code \"Padding 1cm\" \\\n\t\t--outfile qr.pdf \\\n\t\t--error_correction L \\\n\t\t--size 10cm \\\n\t\t--padding 1cm \\\n\t\t--radius 3.5 \\\n\t\t--enhanced-path \\\n\t\t--gradient \"linear 0 1 1 0 0.1 \\#ff0000 0.9 \\#0000ff\"\n\n.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/crazy.png?v2022-10-09\n\nParameter list\n^^^^^^^^^^^^^^\n\n.. list-table:: Parameters\n\t:header-rows: 1\n\n\t* - Name\n\t  - Default\n\t  - Description\n\t* - ``size``\n\t  - 5cm\n\t  - size of code\n\t* - ``padding``\n\t  - 2.5\n\t  - padding size, without any unit this meanss 2.5 QR code pixels, it can be\n\t    absolute value (like 1cm) or relative value (10%)\n\t* - ``fg``\n\t  - black\n\t  - foreground color\n\t* - ``bg``\n\t  - transparent\n\t  - background color\n\t* - ``invert``\n\t  - False\n\t  - invert pixel values\n\t* - ``mask``\n\t  - False\n\t  - render only mask\n\t* - ``negative``\n\t  - False\n\t  - render negative of code\n\t* - ``version``\n\t  - 1\n\t  - version passed to qr code library\n\t* - ``error_correction``\n\t  - 'L'\n\t  - error_correction passed to qr code library (can be L, M, Q or H)\n\t* - ``x``\n\t  - 0\n\t  - x offset\n\t* - ``y``\n\t  - 0\n\t  - y offset\n\t* - ``hole``\n\t  - []\n\t  - list of holes in form ``x:y:w:h\u2026`` (can be repeated)\n\t* - ``draw``\n\t  - +all\n\t  - select elements to draw. Prefix + (plus) means include, - (minus)\n\t    exclude. Allowed options are: ``'all'``, ``'eye[1-3]'``, ``'eyes'``,\n\t    ``'eyepupil[1-3]'``, ``'eyepupils'``, ``'eyeball[1-3]'``, ``'eyeballs'``,\n\t    ``'align'``, ``'alignpupils'`` and ``'alignballs'``\n\nExamples\n--------\n\nPython examle:\n\n.. code:: python\n\n\tfrom reportlab.pdfgen import canvas\n\tfrom reportlab_qr_code import qr_draw\n\n\tdef main():\n\t\tc = canvas.Canvas(\"py.pdf\")\n\t\tqr_draw(c, \"Hello world\", x=\"1cm\", y=\"1cm\", size=\"19cm\", bg=\"#eeeeee\")\n\t\tc.showPage()\n\t\tc.save()\n\n\tif __name__ == \"__main__\":\n\t\tmain()\n\nRML document example:\n\n.. code:: xml\n\n\t<!DOCTYPE document SYSTEM \"rml_1_0.dtd\" [\n\t<!ENTITY lines5 \"\n\t\t0cm 0cm 0cm 0.5cm\n\t\t0cm 0cm 0.5cm 0cm\n\t\t5cm 0cm 4.5cm 0cm\n\t\t5cm 0cm 5cm 0.5cm\n\t\t0cm 5cm 0.5cm 5cm\n\t\t0cm 5cm 0cm 4.5cm\n\t\t5cm 5cm 5cm 4.5cm\n\t\t5cm 5cm 4.5cm 5cm\n\t\">\n\t<!ENTITY lines3 \"\n\t\t0cm 0cm 0cm 0.5cm\n\t\t0cm 0cm 0.5cm 0cm\n\t\t3cm 0cm 2.5cm 0cm\n\t\t3cm 0cm 3cm 0.5cm\n\t\t0cm 3cm 0.5cm 3cm\n\t\t0cm 3cm 0cm 2.5cm\n\t\t3cm 3cm 3cm 2.5cm\n\t\t3cm 3cm 2.5cm 3cm\n\t\">\n\t]>\n\t<document filename=\"test.pdf\" invariant=\"1\" compression=\"1\">\n\t<template>\n\t\t<pageTemplate id=\"main\" pagesize=\"17cm,39cm\">\n\t\t\t<frame id=\"main\" x1=\"0.5cm\" y1=\"0.0cm\" width=\"5cm\" height=\"39cm\"/>\n\t\t\t<frame id=\"main\" x1=\"6cm\" y1=\"0.0cm\" width=\"5cm\" height=\"39cm\"/>\n\t\t\t<frame id=\"main\" x1=\"11.5cm\" y1=\"0.0cm\" width=\"5cm\" height=\"39cm\"/>\n\t\t</pageTemplate>\n\t</template>\n\t<stylesheet>\n\t\t<paraStyle name=\"Normal\" fontSize=\"12\" leading=\"16\" spaceBefore=\"16\" />\n\t</stylesheet>\n\t<story>\n\t\n\t\t<para style=\"Normal\">Simple text </para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">;text;Simple text</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Custom size</para>\n\t\t<illustration height=\"3cm\" width=\"3cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">size=3cm;text;Custom size</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines3;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Base 64 encoded</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">;base64;QmFzZSA2NCBlbmNvZGVk</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Custom colors</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">bg=#eeeeee,fg=#a00000;text;Custom colors</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Padding 20%</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">padding=20%;text;Padding 20%</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Padding 1cm</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">padding=1cm;text;Padding 1cm</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Padding 1 pixel</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">padding=1;text;Padding 1 pixel</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Error correction M</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">error_correction=M;text;Error correction</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Error correction L</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">error_correction=L;text;Error correction</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Version 10</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">version=10;text;Version 10</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para style=\"Normal\">Small radius</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">radius=0.5;text;Small radius</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para style=\"Normal\">Round with better path</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">radius=0.5,enhanced_path=1;text;ROUND WITH BETTER PATH</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para style=\"Normal\">Large radius</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">radius=3.5;text;Large radius</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Inverted</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic baseDir=\".\" module=\"utils\" function=\"gradient\" />\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">padding=0,fg=#ffffff,invert=1;text;Inverted</plugInGraphic>\n\t\t\t<lineMode width=\"2\" />\n\t\t\t<stroke color=\"#ffffff\" />\n\t\t\t<rect x=\"0\" y=\"0\" width=\"5cm\" height=\"5cm\" fill=\"0\" stroke=\"1\" />\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para>Mask</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">mask=1,radius=0.5,enhanced_path=1;text;Mask</plugInGraphic>\n\t\t\t<plugInGraphic baseDir=\".\" module=\"utils\" function=\"gradient\" />\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para style=\"Normal\">Hole</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">hole=20%:40%:60%:20%,error_correction=H,radius=0.3,enhanced_path=1;text;Hole inside QR code</plugInGraphic>\n\t\t\t<setFont name=\"Helvetica\" size=\"18\"/>\n\t\t\t<drawString x=\"1.8cm\" y=\"2.35cm\">Logo</drawString>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t</illustration>\n\t\n\t\t<condPageBreak height=\"7cm\"/>\n\t\n\t\t<para style=\"Normal\">Logo</para>\n\t\t<illustration height=\"5cm\" width=\"5cm\" align=\"center\">\n\t\t\t<plugInGraphic module=\"reportlab_qr_code\" function=\"qr\">padding=2,radius=0.5,hole=35%:35%:30%:30%,fg=#554488,error_correction=H,draw=all-align-eyes,draw=alignpupils,radius=0.25,draw=alignballs,fg=#e24329,radius=1,draw=eyeball2+eyeball3,radius=3.5,fg=#fca326,draw=eyeball1,radius=3.5,fg=#e24329,draw=eyepupils,fg=#44366d,radius=3.5;text;https://about.gitlab.com/</plugInGraphic>\n\t\t\t<lineMode width=\"0.5\" /><lines>&lines5;</lines>\n\t\t\t<image file=\"gitlab.svg\" x=\"1.8cm\" y=\"1.8cm\" width=\"1.4cm\" height=\"1.4cm\"/>\n\t\t</illustration>\n\t</story>\n\t</document>\n\nOutput:\n\n.. image:: https://raw.github.com/wiki/mireq/reportlab-qr-code/codes.png?v2023-05-28\n\n\n.. |codecov| image:: https://codecov.io/gh/mireq/reportlab-qr-code/branch/master/graph/badge.svg?token=QGY5B5X0F3\n\t:target: https://codecov.io/gh/mireq/reportlab-qr-code\n\n.. |version| image:: https://badge.fury.io/py/reportlab-qr-code-generator.svg\n\t:target: https://pypi.python.org/pypi/reportlab-qr-code-generator/\n\n.. |downloads| image:: https://img.shields.io/pypi/dw/reportlab-qr-code-generator.svg\n\t:target: https://pypi.python.org/pypi/reportlab-qr-code-generator/\n\n.. |license| image:: https://img.shields.io/pypi/l/reportlab-qr-code-generator.svg\n\t:target: https://pypi.python.org/pypi/reportlab-qr-code-generator/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "QR code plugin for reportlab and RML language",
    "version": "1.7.0",
    "project_urls": {
        "changelog": "https://github.com/mireq/reportlab-qr-code/blob/master/CHANGELOG.md",
        "documentation": "https://github.com/mireq/reportlab-qr-code",
        "homepage": "https://github.com/mireq/reportlab-qr-code",
        "repository": "https://github.com/mireq/reportlab-qr-code"
    },
    "split_keywords": [
        "qr code",
        "rml",
        "reportlab"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0794b32610a4f0c456d2a74eeb8b01742512f2abfc1115f23c36d3c676171e84",
                "md5": "50580e03ba74396d0a34264a784f84a2",
                "sha256": "9c289b41b2bb6d8e90ffa490a75f0b75e6472ebb3c1b80581171f8fd570a2e70"
            },
            "downloads": -1,
            "filename": "reportlab_qr_code_generator-1.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "50580e03ba74396d0a34264a784f84a2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 15033,
            "upload_time": "2023-05-28T10:26:16",
            "upload_time_iso_8601": "2023-05-28T10:26:16.493006Z",
            "url": "https://files.pythonhosted.org/packages/07/94/b32610a4f0c456d2a74eeb8b01742512f2abfc1115f23c36d3c676171e84/reportlab_qr_code_generator-1.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50f375e30ea5ef5fcce0a3e812c1ea0de73e4c80cfd78fcff135404fab488692",
                "md5": "2c316ff387afcb6d7ff7de0cf0ac9f33",
                "sha256": "069c2021027be28abb44f11cdf18642c582d4afe860eb68ca8d4257e7d3cf910"
            },
            "downloads": -1,
            "filename": "reportlab_qr_code_generator-1.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2c316ff387afcb6d7ff7de0cf0ac9f33",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 30377,
            "upload_time": "2023-05-28T10:26:19",
            "upload_time_iso_8601": "2023-05-28T10:26:19.275476Z",
            "url": "https://files.pythonhosted.org/packages/50/f3/75e30ea5ef5fcce0a3e812c1ea0de73e4c80cfd78fcff135404fab488692/reportlab_qr_code_generator-1.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-28 10:26:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mireq",
    "github_project": "reportlab-qr-code",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "reportlab-qr-code-generator"
}
        
Elapsed time: 0.09154s