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. Generating code128 barcode
Forum Updated to NodeBB v4.3 + New Features

Generating code128 barcode

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 397 Views 2 Watching
  • 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.
  • T Offline
    T Offline
    Thananjeyan
    wrote on 17 Jun 2024, 11:09 last edited by
    #1

    WhatsApp Image 2024-06-17 at 4.07.13 PM.jpeg
    the above image was my expected output but creating code 128 barcode by using this reference https://github.com/promixis/Code128, i got the below image as my output
    b4a6e167-77f5-44a2-84b8-9c03271d5f48-image.png

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 17 Jun 2024, 11:23 last edited by
      #2

      And what's the relation to Qt here? You should ask the developer how to use the library if you have issues with it.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • T Offline
        T Offline
        Thananjeyan
        wrote on 17 Jun 2024, 11:26 last edited by
        #3

        I want to generate the bar code through QT c++. but i have no idea to generate bar code as the above expected image

        P 1 Reply Last reply 17 Jun 2024, 11:42
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 17 Jun 2024, 11:30 last edited by
          #4

          And what did you try? What issues did you face? Provide some code - we won't write code for you.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • T Thananjeyan
            17 Jun 2024, 11:26

            I want to generate the bar code through QT c++. but i have no idea to generate bar code as the above expected image

            P Offline
            P Offline
            Pl45m4
            wrote on 17 Jun 2024, 11:42 last edited by Pl45m4
            #5

            @Thananjeyan said in Generating code128 barcode:

            i have no idea to generate bar code as the above expected image

            If you look at the wiki page linked in your mentioned GitHub repo above (this one here), you can see that the produced Code128 does not look like your "expected image".

            Qt still has nothing to do with it (that the output of this library is not what you expect).
            And there is nothing as "Qt" C++... it's just C++. If it works in any C++ program, you can integrate it together with a Qt GUI.


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Thananjeyan
              wrote on 17 Jun 2024, 12:12 last edited by Thananjeyan
              #6
              code_text
              ```m_Scene.update();
                      ui->graphicsView_2->update();
                      ui->graphicsView_2->setScene(&m_Scene);
                      m_Barcode = new Code128Item();
                      m_Barcode->setHighDPI(true);
                      m_Barcode->setWidth(200);
                      m_Barcode->setHeight(70);
                      m_Barcode->setPos(0,0);
                      m_Barcode->update();
                      m_Scene.addItem(m_Barcode);
                      m_Scene.update();
                      m_Barcode->update();
                      m_Barcode->setText("B6560");
                      m_Barcode->update();
                      ui->graphicsView_2->setScene(&m_Scene);
                      ui->graphicsView_2->update();
                      ui->graphicsView_2->setFixedSize(m_Scene.sceneRect().width(),m_Scene.sceneRect().height());
                      ui->graphicsView_2->update();
                      ui->graphicsView_2->setScene(&m_Scene);
                      ui->graphicsView_2->fitInView(0,0,m_Scene.sceneRect().width(),m_Scene.sceneRect().height(), Qt::IgnoreAspectRatio);
                      ui->graphicsView_2->update();
                      QImage pixMap(1900,1024,QImage::Format_ARGB32_Premultiplied);
                      pixMap.fill(Qt::transparent);
                      QPainter p(&pixMap);
                      m_Scene.render(&p);
                      p.end();
                      pixMap.save("D:/Barcode/img1.png");
                      QThread::msleep(1000);
                      Imagepath="D:/Barcode/img1.png";
              
              code_text
              

              image.png
              this is the program i used to get the above output now i just want to reduce width of the barcode and barcode stripes```

              P 1 Reply Last reply 17 Jun 2024, 12:27
              0
              • T Thananjeyan
                17 Jun 2024, 12:12
                code_text
                ```m_Scene.update();
                        ui->graphicsView_2->update();
                        ui->graphicsView_2->setScene(&m_Scene);
                        m_Barcode = new Code128Item();
                        m_Barcode->setHighDPI(true);
                        m_Barcode->setWidth(200);
                        m_Barcode->setHeight(70);
                        m_Barcode->setPos(0,0);
                        m_Barcode->update();
                        m_Scene.addItem(m_Barcode);
                        m_Scene.update();
                        m_Barcode->update();
                        m_Barcode->setText("B6560");
                        m_Barcode->update();
                        ui->graphicsView_2->setScene(&m_Scene);
                        ui->graphicsView_2->update();
                        ui->graphicsView_2->setFixedSize(m_Scene.sceneRect().width(),m_Scene.sceneRect().height());
                        ui->graphicsView_2->update();
                        ui->graphicsView_2->setScene(&m_Scene);
                        ui->graphicsView_2->fitInView(0,0,m_Scene.sceneRect().width(),m_Scene.sceneRect().height(), Qt::IgnoreAspectRatio);
                        ui->graphicsView_2->update();
                        QImage pixMap(1900,1024,QImage::Format_ARGB32_Premultiplied);
                        pixMap.fill(Qt::transparent);
                        QPainter p(&pixMap);
                        m_Scene.render(&p);
                        p.end();
                        pixMap.save("D:/Barcode/img1.png");
                        QThread::msleep(1000);
                        Imagepath="D:/Barcode/img1.png";
                
                code_text
                

                image.png
                this is the program i used to get the above output now i just want to reduce width of the barcode and barcode stripes```

                P Offline
                P Offline
                Pl45m4
                wrote on 17 Jun 2024, 12:27 last edited by Pl45m4
                #7

                @Thananjeyan said in Generating code128 barcode:

                now i just want to reduce width of the barcode and barcode stripes

                You can resize the whole image with Qt... but I don't see how you want to "reduce barcode stripes"?!
                The output image is generated by this Code128 lib, right?! Check if there are any options to do so.

                QThread::msleep(1000);

                What is this doing there?!

                Edit:

                @Thananjeyan your "slim" barcode from the photo above could be Code128 barcode without the checksum.
                I don't know if you can make your library print the "data" only, without adding any checkum and how you can read it later...

                • https://stackoverflow.com/questions/53098714/is-a-checksum-required-in-the-code128-barcode-specification

                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                1 Reply Last reply
                2

                1/7

                17 Jun 2024, 11:09

                • Login

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