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. Read barcode from PDF document
Forum Updated to NodeBB v4.3 + New Features

Read barcode from PDF document

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 3.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.
  • J Offline
    J Offline
    jacekkozik
    wrote on last edited by
    #1

    Hi, I have a question. Is there a way to convert pdf to jpg?
    I need to read the images from a pdf document. I am using QZXing to read barcodes. Barcodes must be in image format (jpg, png ...)

    Thanks for the help.

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

      Hi
      You can use command lines tools to do it.
      https://gist.github.com/yura/670974

      J 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        You can use command lines tools to do it.
        https://gist.github.com/yura/670974

        J Offline
        J Offline
        jacekkozik
        wrote on last edited by
        #3

        Ok. But I want do this in my application. Your solution working on other application.

        mrjjM 1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Hi! ImageMagick can convert PDF to JPEG. If you don't want to use it as a command-line tool, you can also use it as a library.

          1 Reply Last reply
          3
          • J jacekkozik

            Ok. But I want do this in my application. Your solution working on other application.

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

            @jacekkozik
            There is no good way to do this directly in Qt.
            You might be able to display a pdf and screen grab it but calling external cmdline program with
            QProcess will work far better.
            Or as wieland suggest using ImageMagick library.

            There is also this
            http://blog.qt.io/blog/2017/01/30/new-qtpdf-qtlabs-module/
            Says "QPdfDocument can render a PDF page to a QImage"
            But i have not tried it.

            ? W 2 Replies Last reply
            1
            • mrjjM mrjj

              @jacekkozik
              There is no good way to do this directly in Qt.
              You might be able to display a pdf and screen grab it but calling external cmdline program with
              QProcess will work far better.
              Or as wieland suggest using ImageMagick library.

              There is also this
              http://blog.qt.io/blog/2017/01/30/new-qtpdf-qtlabs-module/
              Says "QPdfDocument can render a PDF page to a QImage"
              But i have not tried it.

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              @mrjj said in Read barcode from PDF document:

              There is also this
              http://blog.qt.io/blog/2017/01/30/new-qtpdf-qtlabs-module/
              Says "QPdfDocument can render a PDF page to a QImage"

              Awesome! \o/

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

                Ok, i downloaded ImageMagick-i686-pc-mingw32.tar.gz.
                And now as I type

                convert f.pdf d.jpg
                

                f.pdf is in the same directory as convert.exe

                I get the message:

                convert.exe: UnableToOpenConfigureFile `delegates.xml' @ warning/configure.c/GetConfigureOptions/616.
                convert.exe: `%s' (%d) "gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=C:/Users/ADMINI~1/AppData/Local/Temp/magick-21380jSugM5nyzl-T-1" "-fC:/Users/ADMINI~1/AppData/Local/Temp/magick-21380wnE6NbHjVB6v" "-fC:/Users/ADMINI~1/AppData/Local/Temp/magick-21380qrAlRMgDXCHT" @ error/utility.c/SystemCommand/2033.
                convert.exe: PostscriptDelegateFailed `f.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/682.
                convert.exe: NoImagesDefined `d.jpg' @ error/convert.c/ConvertImageCommand/3106.
                
                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  When working with PostScript files, ImageMagick relies on another program, "Ghostscript" for the reading and conversion of PostScript and PDF files into a image format it can use. That is to read such documents, Ghostscript needs to be installed on your computer. Its latest version can be downloaded at github.

                  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