Results 1 to 2 of 2

Thread: Portable way to use PDF files for help?

  1. #1
    Join Date
    Nov 2010
    Posts
    22
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Portable way to use PDF files for help?

    I want my application to open a PDF file. Something like this:

    Qt Code:
    1. QDesktopServices::openUrl(QUrl("file:///C:/Data/help.pdf", QUrl::TolerantMode));
    To copy to clipboard, switch view to plain text mode 

    My problem is when I want to open the file at an specific location which should work like this:

    Qt Code:
    1. QDesktopServices::openUrl(QUrl("file:///C:/Data/help.pdf#page=23", QUrl::TolerantMode));
    To copy to clipboard, switch view to plain text mode 

    However the above line will only work if I type the URL within a browser (safari, firefox, iexplorer...) but not from Qt, neither from rundll.exe

    Which one is the best and most portable way? I do not want to look for Acrobat myself for launching a detached process with the right parameters

    thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Portable way to use PDF files for help?

    openURL() is an equivalent to double-clicking the file in a file explorer. There you can't order the OS to pass additional parameters to the file handler and neither can you here. If you wish to open the file in a particular page, you have to bind yourself to a specific pdf browser and call it directly via things like QProcess passing it appropriate parameters. Or you can use libpoppler to display the pdf directly in your own app.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    frank100 (24th March 2011)

Similar Threads

  1. portable getopt() functionality
    By KShots in forum Qt Programming
    Replies: 7
    Last Post: 14th March 2011, 18:19
  2. Portable qmake .pro files...
    By andy.fillebrown in forum Qt Programming
    Replies: 0
    Last Post: 19th September 2009, 23:34
  3. portable qt application on windows
    By eleanor in forum Installation and Deployment
    Replies: 2
    Last Post: 11th November 2007, 17:57
  4. qt portable?
    By vermarajeev in forum General Discussion
    Replies: 1
    Last Post: 20th September 2007, 12:14
  5. Apache Portable Runtime
    By sumsin in forum General Discussion
    Replies: 0
    Last Post: 17th January 2006, 09:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.