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. PDF open problem
Forum Updated to NodeBB v4.3 + New Features

PDF open problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 5.2k Views 1 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.
  • F Offline
    F Offline
    f.lerdino
    wrote on last edited by
    #3

    the file is normally opened...
    I also tried to use xdg-open mypdf.pdf and the pdf file has been opened

    mrjjM 1 Reply Last reply
    0
    • F f.lerdino

      the file is normally opened...
      I also tried to use xdg-open mypdf.pdf and the pdf file has been opened

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

      @f.lerdino
      What Qt is it ?
      Sounds like QDesktopServices broke with update then.
      ( not QDesktopServices faults but something changed in the system)

      JonBJ 1 Reply Last reply
      0
      • mrjjM mrjj

        @f.lerdino
        What Qt is it ?
        Sounds like QDesktopServices broke with update then.
        ( not QDesktopServices faults but something changed in the system)

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by JonB
        #5

        @mrjj
        The final error reads:

        xdg-open: no method available for opening '/home/labotdd/doc3.pdf'

        I don't see how QDesktopServices per se can be blamed for that?

        @f-lerdino
        There are mentions of "root" in the trace. Just to check: you have no root-ness going on when you run the Qt app vs when you do it outside of Qt?

        I also tried to use xdg-open mypdf.pdf and the pdf file has been opened

        Please try with xdg-open /home/labotdd/doc3.pdf

        Also, FWIW, can you try from your Qt app with something other than a .pdf, if your code allows it?

        1 Reply Last reply
        1
        • F Offline
          F Offline
          f.lerdino
          wrote on last edited by
          #6

          for mrjj : I have 5.11.1 and ubuntu 16.04 -kernel 4.13.0.-45.
          for JonB: if I try ro run this 'xdg-open /home/labotdd/doc3.pdf the pdf' the file is opened whitout any problem.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            f.lerdino
            wrote on last edited by
            #7

            @JonB said in PDF open problem:

            Also, FWIW, can you try from your Qt app with something other than a .pdf, if your code allows it?

            I have tried with a txt file and with it works....

            JonBJ 1 Reply Last reply
            0
            • F f.lerdino

              @JonB said in PDF open problem:

              Also, FWIW, can you try from your Qt app with something other than a .pdf, if your code allows it?

              I have tried with a txt file and with it works....

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by JonB
              #8

              @f.lerdino
              Root-ness? Do you have anything root-y going on? By any chance, is your Qt app being run as/by root?

              Is your Qt app a GUI one or command-line only? Are you running Unity or not/other?

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

                Hi
                Also could you list what
                xdg-mime query default application/pdf
                returns ?

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  f.lerdino
                  wrote on last edited by
                  #10

                  @mrjj said in PDF open problem:

                  xdg-mime query default application/pdf

                  labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                  evince.desktop

                  mrjjM JonBJ 3 Replies Last reply
                  0
                  • F f.lerdino

                    @mrjj said in PDF open problem:

                    xdg-mime query default application/pdf

                    labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                    evince.desktop

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

                    Ok. so that is not changed.
                    if u type evince in a shell ( normal user) it starts as normally ?

                    F 1 Reply Last reply
                    0
                    • F f.lerdino

                      @mrjj said in PDF open problem:

                      xdg-mime query default application/pdf

                      labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                      evince.desktop

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by
                      #12

                      @f.lerdino
                      I really think this could be a root issue, which you have not answered. If I deliberately go

                      sudo xdg-open .....pdf
                      

                      I get messages like I see in yours:

                      No protocol specified
                      Unable to init server: Could not connect: Connection refused
                      Cannot parse arguments: Cannot open display: 
                      No protocol specified
                      Unable to init server: Could not connect: Connection refused
                      Cannot parse arguments: Cannot open display: 
                      Warning: program returned non-zero exit code #1
                      
                      1 Reply Last reply
                      1
                      • F f.lerdino

                        @mrjj said in PDF open problem:

                        xdg-mime query default application/pdf

                        labotdd@D7050:/opt/Qt/Tools/QtCreator/bin$ xdg-mime query default application/pdf
                        evince.desktop

                        JonBJ Online
                        JonBJ Online
                        JonB
                        wrote on last edited by
                        #13

                        @f.lerdino
                        I think this is not a Qt issue per se, but an Ubuntu 16.04 one. Try Googling for something like ubuntu 16.04 xdg-open. I think https://askubuntu.com/questions/779717/xdg-open-stopped-working-since-16-04-upgrade might be where you'll find what you need to do... ?

                        1 Reply Last reply
                        1
                        • mrjjM mrjj

                          Ok. so that is not changed.
                          if u type evince in a shell ( normal user) it starts as normally ?

                          F Offline
                          F Offline
                          f.lerdino
                          wrote on last edited by
                          #14

                          @mrjj
                          I have an old version of ubuntu and everything work. Something is changed after the ubuntu update. Of course I run my QT Program as root.

                          mrjjM 1 Reply Last reply
                          0
                          • F f.lerdino

                            @mrjj
                            I have an old version of ubuntu and everything work. Something is changed after the ubuntu update. Of course I run my QT Program as root.

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

                            @f.lerdino
                            The link @JonB gives , suggest that
                            gvfs-info being deprecated.
                            so that might be your actual issue.
                            (some posts down)

                            1 Reply Last reply
                            0
                            • F Offline
                              F Offline
                              f.lerdino
                              wrote on last edited by
                              #16

                              @JonB
                              I use root to run my Qt program

                              mrjjM JonBJ 2 Replies Last reply
                              0
                              • F f.lerdino

                                @JonB
                                I use root to run my Qt program

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

                                @f.lerdino
                                but does it work then if u dont run as root ?

                                1 Reply Last reply
                                1
                                • F f.lerdino

                                  @JonB
                                  I use root to run my Qt program

                                  JonBJ Online
                                  JonBJ Online
                                  JonB
                                  wrote on last edited by JonB
                                  #18

                                  @f.lerdino

                                  I use root to run my Qt program

                                  Scary. Which is why I asked earlier.

                                  Given that the error messages you show are complaining as not being able to do stuff as root, I presume when you tested running the xdg-opens and said they worked you did so as root too?

                                  1 Reply Last reply
                                  0
                                  • F Offline
                                    F Offline
                                    f.lerdino
                                    wrote on last edited by
                                    #19

                                    @JonB said in PDF open problem:

                                    Given that the error messages you show are complaining as not being able to do stuff as root, I presume when you tested running the xdg-opens and said they worked you did so as root too?

                                    Yes I have tried as root...

                                    1 Reply Last reply
                                    0
                                    • F Offline
                                      F Offline
                                      f.lerdino
                                      wrote on last edited by
                                      #20

                                      Can I run as external program the pdf viewer + mypdffile in QT/Ubuntu?

                                      Thanks

                                      mrjjM 1 Reply Last reply
                                      0
                                      • F f.lerdino

                                        Can I run as external program the pdf viewer + mypdffile in QT/Ubuntu?

                                        Thanks

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

                                        @f.lerdino
                                        Well you could run it via QProcess.

                                        1 Reply Last reply
                                        1
                                        • N Offline
                                          N Offline
                                          ndreisg
                                          wrote on last edited by
                                          #22

                                          I have the same problem and it seems like the problem is caused by this firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?format=default&id=1323302
                                          (and the resulting change: https://hg.mozilla.org/mozilla-central/rev/90a06cdcb48f)

                                          It seems like xdg-open uses firefox in background to display the PDF files.

                                          Unfortunately it seems like the firefox team has not provided a possibility to bypass this behavior.
                                          (Chrome Browser for example provides "--no-sandbox" option to start it as root in a non-root user session)

                                          1 Reply Last reply
                                          1

                                          • Login

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