Python Forum
Help with QR Code - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Help with QR Code (/thread-42281.html)



Help with QR Code - Miisato - Jun-11-2024

hey, how can we read qr codes in 1st page from a pdf file
and verify the same qr code is present in all the other pages of the file
tia


RE: Help with QR Code - Larz60+ - Jun-11-2024

there are packages available for reading and displaying qr-codes.
see: PyPi Search Results
Scanner code for PDF


RE: Help with QR Code - Pedroski55 - Jun-11-2024

The QR codes I made were made with the module qrcode.

They are .png images

To read the info contained, you can use cv2 (which gives computers eyes!):

import cv2
from pyzbar import pyzbar as pzb

qr = '/home/pedro/summer2023/OMR/21BE/21BE_QRcodes/21BE1/2125010102_曹宇_QR.png'

image = cv2.imread(qr)
decodedObjects = pzb.decode(image)
for obj in decodedObjects:
    print("Type:", obj.type)    
    print("Data: ", obj.data, "\n")
    # this is the content of the QR code as a string
    string=obj.data.decode('utf-8')
    print(f'The information in this QR code is: {string}') 
How to get an image from a PDF? Ask another question here, or look on the web!


RE: Help with QR Code - Gribouillis - Jun-11-2024

Also you could perhaps start by extracting the images from the pdf document. For example in Linux this can be done with the 'pdfimages' command that comes with the 'poppler' library.


RE: Help with QR Code - AdamHensley - Jun-17-2024

You can use Python with PyPDF2 and pyzbar for this. Just scan the QR code on the first page, then loop through the other pages to check if their QR codes match.