Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QR code generator for print layout #28997

Closed
qgib opened this issue Feb 5, 2019 · 3 comments
Closed

QR code generator for print layout #28997

qgib opened this issue Feb 5, 2019 · 3 comments
Labels
Feature Request Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks Won't fix By design, or won't be fixed for some other reason

Comments

@qgib
Copy link
Contributor

qgib commented Feb 5, 2019

Author Name: Dennis Real (Dennis Real)
Original Redmine Issue: 21179

Redmine category:map_composer/printing


When creating a print map or an atlas you might want to provide some of the information am the printed map in machine readable form by a QR code.

In addition to maps, textfields, images, ... there should be a QR code object which will generate dynamic QR code images that can be scanned with a phone.

@qgib
Copy link
Contributor Author

qgib commented Feb 8, 2019

Author Name: Julien Monticolo (Julien Monticolo)


As workaround, if you have internet connection, you can create a custom function :

from urllib import parse

@qgsfunction(args='auto', group='url')
def url_quote(string, feature, parent):
    """
    Replace special characters in string using the %xx escape.
    Letters, digits, and the characters '_.-~' are never quoted,
    replace spaces by plus signs, as required for quoting HTML form values
    when building up a query string to go into a URL.
    By default, this function is intended for quoting the path section of URL.
    
    <h2>Example usage:</h2>
    <ul>
      <li>url_quote('/El Niño/') -> '%2FEl+Ni%C3%B1o%2F'</li>
      <li>url_quote('https://qgis.org/en/site/') -> 'https%3A%2F%2Fqgis.org%2Fen%2Fsite%2F'</li>
    </ul>
    """
    string = parse.quote_plus(string)
    return string

and in the layout, add a label item with an html rendering (tick the option case), and paste the code :

[% '<img src="http://api.qrserver.com/v1/create-qr-code/?size=350x350&data=' ||
url_quote('HelloWorld!')
|| '"</img>' %]

for a 350 pixels QR code with the 'HelloWorld!' info.

@qgib qgib added Feature Request Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks labels May 25, 2019
@Saijin-Naib
Copy link

I'd like to see this as an option, as well. I think this could be incredibly handy for paper maps/reports/survey forms, so that they can more easily be traced back to the proper feature.

@nyalldawson
Copy link
Collaborator

I've looked into this in the past, and it's an ideal candidate for a plugin rather than core functionality. There's existing python libraries for qr generation, and plugins can expose new item types to layouts, so all the building blocks are in place.

Closing as a wontfix, from the aspect that this isn't a feature which needs to be in core qgis.

@nyalldawson nyalldawson added the Won't fix By design, or won't be fixed for some other reason label Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks Won't fix By design, or won't be fixed for some other reason
Projects
None yet
Development

No branches or pull requests

3 participants