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. How to print barcode on the page or pdf document?
Forum Updated to NodeBB v4.3 + New Features

How to print barcode on the page or pdf document?

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 4 Posters 2.0k 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.
  • MucipM Offline
    MucipM Offline
    Mucip
    wrote on last edited by
    #1

    Hi,
    I searched the forum but usually old posts and reading samplas. Not writing?!

    Well, I need to print order form on the page. But I want to print order number as barcode on the same page too.

    Any advice?...

    Regards,
    Mucip:)

    GerhardG 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      There are many barcode formats
      so which one do you need ?

      Some are easy to generate "manually"
      https://www.codeproject.com/Articles/2434/Drawing-Barcodes-in-Windows-Part-1-Code-39

      Anyway, i personally like
      https://github.com/zint/zint

      MucipM 1 Reply Last reply
      3
      • mrjjM mrjj

        Hi
        There are many barcode formats
        so which one do you need ?

        Some are easy to generate "manually"
        https://www.codeproject.com/Articles/2434/Drawing-Barcodes-in-Windows-Part-1-Code-39

        Anyway, i personally like
        https://github.com/zint/zint

        MucipM Offline
        MucipM Offline
        Mucip
        wrote on last edited by
        #3

        Hi @mrjj ,
        I checked zint infact but did not understand how to use?!...
        How can I use it in my source code?...

        Regards,
        Mucip:)

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          Well you can build lib with cmake.
          there should be cmake project file somewhere.
          its a c api so its a bit "raw"
          http://www.zint.org.uk/Manual.aspx?type=p&page=5

          MucipM 1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Well you can build lib with cmake.
            there should be cmake project file somewhere.
            its a c api so its a bit "raw"
            http://www.zint.org.uk/Manual.aspx?type=p&page=5

            MucipM Offline
            MucipM Offline
            Mucip
            wrote on last edited by
            #5

            Hİ @mrjj ,
            Well, is there any sample how to use this library in Qt?

            It must be a easier way to print barcodes in Qt!...

            Regards,
            Mucip:)

            jsulmJ 1 Reply Last reply
            0
            • MucipM Mucip

              Hİ @mrjj ,
              Well, is there any sample how to use this library in Qt?

              It must be a easier way to print barcodes in Qt!...

              Regards,
              Mucip:)

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Mucip The examples are right there: http://www.zint.org.uk/Manual.aspx?type=p&page=5
              They do not use Qt, but it is just C++.
              If you think Qt should support bardcodes you can file a change request or even submit a patch.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • MucipM Offline
                MucipM Offline
                Mucip
                wrote on last edited by
                #7

                Hi,
                I think I can do it with Zint CLI

                http://www.zint.org.uk/Manual.aspx?type=p&page=4

                It creates the barcode png of the requested data very easilly.
                By the way there is qt GUI version too. But I couldn't run it anyway. :)

                http://www.zint.org.uk/Manual.aspx?type=p&page=3

                Now issue is as SOLVED for me...

                Regards,
                Mucip:)

                1 Reply Last reply
                1
                • MucipM Offline
                  MucipM Offline
                  Mucip
                  wrote on last edited by
                  #8

                  Hi,
                  I tryed to use zint as below but did not get success?!

                  QProcess process;
                  process.setWorkingDirectory("D:\\ProgramFiles\\Zint\");
                  process.start("zint.exe", QStringList() << " -o c:\\sil\\kod.png -d 'CSI0070-1200'");

                  Why?...

                  Regards,
                  Mucip:)

                  mrjjM jsulmJ 2 Replies Last reply
                  0
                  • MucipM Mucip

                    Hi,
                    I tryed to use zint as below but did not get success?!

                    QProcess process;
                    process.setWorkingDirectory("D:\\ProgramFiles\\Zint\");
                    process.start("zint.exe", QStringList() << " -o c:\\sil\\kod.png -d 'CSI0070-1200'");

                    Why?...

                    Regards,
                    Mucip:)

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Mucip
                    Hi
                    QProcess has error signal you can try to hook up to and see what it says.
                    often that gives clues to what happens.

                    1 Reply Last reply
                    1
                    • MucipM Mucip

                      Hi,
                      I tryed to use zint as below but did not get success?!

                      QProcess process;
                      process.setWorkingDirectory("D:\\ProgramFiles\\Zint\");
                      process.start("zint.exe", QStringList() << " -o c:\\sil\\kod.png -d 'CSI0070-1200'");

                      Why?...

                      Regards,
                      Mucip:)

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Mucip said in How to print barcode on the page or pdf document?:

                      " -o c:\sil\kod.png -d 'CSI0070-1200'

                      This is wrong. Each parameter needs to be a string, not all in one string...

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      MucipM 2 Replies Last reply
                      2
                      • jsulmJ jsulm

                        @Mucip said in How to print barcode on the page or pdf document?:

                        " -o c:\sil\kod.png -d 'CSI0070-1200'

                        This is wrong. Each parameter needs to be a string, not all in one string...

                        MucipM Offline
                        MucipM Offline
                        Mucip
                        wrote on last edited by
                        #11

                        Hi @jsulm ,
                        I changed do below but still nothing?!

                        process.start("zint.exe", QStringList() << "-o c:\\sil\\kod.png" << "-d 'CSI0070-1200'");

                        Regards,
                        Mucip:)

                        1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @Mucip said in How to print barcode on the page or pdf document?:

                          " -o c:\sil\kod.png -d 'CSI0070-1200'

                          This is wrong. Each parameter needs to be a string, not all in one string...

                          MucipM Offline
                          MucipM Offline
                          Mucip
                          wrote on last edited by
                          #12

                          Hi @jsulm
                          Noe it worked... Thanks...

                          process.start("zint.exe", QStringList() << "-o" << "c:\sil\kod.png" << "-d" << "'CSI0070-1200'");

                          Regards,
                          Mucip:)

                          1 Reply Last reply
                          0
                          • MucipM Mucip

                            Hi,
                            I searched the forum but usually old posts and reading samplas. Not writing?!

                            Well, I need to print order form on the page. But I want to print order number as barcode on the same page too.

                            Any advice?...

                            Regards,
                            Mucip:)

                            GerhardG Offline
                            GerhardG Offline
                            Gerhard
                            wrote on last edited by
                            #13

                            @Mucip
                            Windows: Install any downloaded Barcode font on your machine and print the order number with this font

                            Gerhard

                            Gerhard

                            MucipM 1 Reply Last reply
                            1
                            • GerhardG Gerhard

                              @Mucip
                              Windows: Install any downloaded Barcode font on your machine and print the order number with this font

                              Gerhard

                              MucipM Offline
                              MucipM Offline
                              Mucip
                              wrote on last edited by
                              #14

                              Hi @Gerhard,
                              But in this case, you need to install same barcode fonts on every deployed machines. And this is not clear solution for me unfortunatelly... :(

                              Regards,
                              Mucip:)

                              mrjjM 1 Reply Last reply
                              0
                              • MucipM Mucip

                                Hi @Gerhard,
                                But in this case, you need to install same barcode fonts on every deployed machines. And this is not clear solution for me unfortunatelly... :(

                                Regards,
                                Mucip:)

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                Just as a note.
                                you can bundle the font with the app as a resource
                                and activate it via
                                int id = QFontDatabase::addApplicationFont(":/fonts/monospace.ttf");

                                1 Reply Last reply
                                2

                                • Login

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