Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT + ZBar read barcode from jpg/pdf
Qt 6.11 is out! See what's new in the release blog

QT + ZBar read barcode from jpg/pdf

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 3.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jacekkozik
    wrote on last edited by
    #1

    Hi, I have a problem with ZBAR. Please help.
    I would like to read the code from a jpg / pdf file and assign it to a variable. Can someone show me a simple example?

    Today I downloaded and unzipped ZBAR. I added "zbar.h" and the ZBAR folder to the project.

    Please help.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      luca
      wrote on last edited by
      #2

      Don't know if can help but some time ago I used QZxing.
      I suggest you to try. There are also a lot of example.

      You ca also read this: https://www.kdab.com/efficient-barcode-scanning-qzxing/

      1 Reply Last reply
      1
      • J Offline
        J Offline
        jacekkozik
        wrote on last edited by
        #3

        Thanks, I was successful with JPG / PNG

        https://github.com/ftylitak/qzxing

        Copy source code folder of QZXing to the root of your project. Add the following line to your .pro file. For more information see here.

        include(QZXing/QZXing.pri)
        
        #include <QZXing.h>
        
        int main() 
        {
        	QImage imageToDecode("file.png");
        	QZXing decoder;
        	decoder.setDecoder( QZXing::DecoderFormat_QR_CODE | QZXing::DecoderFormat_EAN_13 );
        	QString result = decoder.decodeImage(imageToDecode);
        }
        

        But I have a problem with PDF. Is there a simple method? Do I need to convert pdf pages to image.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          luca
          wrote on last edited by
          #4

          @jacekkozik said in QT + ZBar read barcode from jpg/pdf:

          But I have a problem with PDF. Is there a simple method? Do I need to convert pdf pages to image.

          I think you should convert it to QImage and parse it.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            damianleee
            Banned
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved