Results 1 to 10 of 10

Thread: Qt, pdf files and help functions

  1. #1
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Qt, pdf files and help functions

    Good afternoon --

    My client and I were talking last night about adding a help feature to his application. I was thinking using the tool tips for the widgets but he said that his PDF help document that he already has is too extensive to retype back in so what he wants is a feature similar to the F1 feature within Qt Creator so that when he hovers over a widget, clicks help, it would bring up the PDF to the exact location in the document for that widget. Doing some cursory searching I see there's various ways to display a PDF so my initial questions are:

    1) Is this even possible, to jumpt to a location like this?
    2) Is there a preferred method of displaying a PDF? I see poppler and ghostscript quite a bit popping up.
    3) I've considered dropping the PDF into my database and then reading it back out and displaying it but that's and idea.

    I made the mistake of showing how Qt Creator handled the help/F1 within the code editor, and he'd like something similar if possible. Never show a client what's possible, especially when they're a relative



    Kodi

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt, pdf files and help functions

    Never mix business and relatives. Hope you're learning a lesson here.

    Is the PDF document bookmarked? If so, do either Poppler or Ghostscript have an API that let you navigate to a bookmark?

    Another option: Convert the PDF to HTML and use QtWebKit to display it. This PDF to HTML tool looks pretty impressive: PDFToHTML There is also this tool which might let you turn it into a Qt Assistant document.

    After further research, I see that PDFToHTML is now part of Poppler. This looks interesting enough that I might try it out.
    Last edited by d_stranz; 11th August 2012 at 19:44.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt, pdf files and help functions

    I got put in a corner with the relative and a large dollar offer if I created the app; sometimes you take one for the team

    I don't know if the PDF is bookmarked -- I'll need to get a copy of it to find out -- but I like the idea of converting it to HTML or maybe the extraction toolkit. Looks like time to experiment -- thanks for the tips!


    Kodi



    I'm liking QHelpEngine API as an option, but I'd have to deconstruct the PDF documentation...
    Last edited by mtnbiker66; 12th August 2012 at 19:05.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt, pdf files and help functions

    To satisfy my own curiosity, I downloaded the Poppler source and managed to build it (in Windows, using Visual Studio) after a bit of work (had to download freetype, and it requires CMake to build the VS projects).

    It includes a Qt4 extension that allow you to display and navigate through a PDF file in a Qt app; there is a demo that illustrates this. The extension is documented here.

    The major issue of concern is that poppler is GPL, not LGPL, so if your relative is intending to sell the software you write or use it commercially, you will have to get a commercial license. The company Glyph and Gog (www.glyphandcog.com), which owns the rights to the Xpdf code that is used in poppler, licenses a PDF viewer widget for Qt, XpdfWidget. No idea what it costs, but I will be looking into it.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt, pdf files and help functions

    I need to be able to compile it on Windows and Mac -- I did notice it looks a little tricky and I didn't get a chance to play with it this weekend (a very active 14 month old rules the roost)...

    The app I'm writing is meant to be a "helper" tool for a simulation program which currently accepts a flat-file for data entry; I'm creating a database of the data he uses so that he can create his flat-file faster so he can run more simulations. There is the potential for licensing to some of his clients who currently license his app, so I'll have to bring that up to him -- thanks for the catch of that; totally slipped by me!

    I found this thread, too: http://www.qtcentre.org/threads/4887...-and-write-pdf


    Kodi

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt, pdf files and help functions

    Well, ActiveX isn't going to work so well on the Mac OS, I don't think. Does the Acrobat Reader COM API have sufficient flexibility that you can direct it to a specific page in the document? If so, that would be an easy implementation on Windows. Wrap the Ax stuff in a controller class that hides the details from your app so you could potentially replace it if something more portable is required. Your work would then boil down to creating a cross-index between help topic and PDF page number so you could open the document to the appropriate page. I would make the PDF controller class a member of your MainWindow class so you could keep the document open and simply go to a different page once it is initially opened. I don't know if Reader is smart enough not to open the same document twice through the Ax interface. You'd also have to make sure the Ax API could tell you if the user manually closed the document so you could free up the pointer.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  7. #7
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt, pdf files and help functions

    Yea, I knew it wouldn't work on a Mac but it's an option. You've definitely nailed what I was thinking I wanted to do -- now if I can just find the skills to make that happen I'm going to research this option more tonight -- during a lunch break at my day job just doesn't cut it but I can let you know...I've got a e-mail off the folks at Glyph and Cog about licensing and I've also been playing with converting the PDF to HTML, but that generated a lot of jpg files that I wasn't expecting, so I'm not sure how that will play out.

    Thanks for your suggestions!



    Kodi


    yet another possibility: http://qt-apps.org/content/show.php?content=149637
    Last edited by mtnbiker66; 13th August 2012 at 21:18.

  8. #8
    Join Date
    Jan 2012
    Posts
    46
    Thanks
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt, pdf files and help functions

    Somewhat over thinking this a bit in some w-- using QDesktopServices:penUrl(QUrl()) opens the PDF to whatever the default application is for the OS -- it however seems to lack the ability to jump to a page in the document when the "#page=" option is added to the URL. That I understand is what's desired --

  9. #9

    Default Re: Qt, pdf files and help functions

    Hi, mtnbiker66.
    Thanks for your nice sharing. As you see, there are many free conversion tools online. But I don't suggest you to use them to do with your conversion work. Because I always believe that the free tools online do not have so many professional functions as the paid ones. And it is said that some of them might contain some virus. Check some free trials of the paid professional conversion tools to
    convert pdf to jpg using C#.NET first before you make your final decision if possible. I also suggest you choose one whose way of processing is simple and fast. It can save a laot of time for you. Remember to do your conversion work according to its tutorial page about PDF to image conversion. I hope you success. Good luck.



    Best regards,
    Pan

  10. #10
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt, pdf files and help functions

    I would guess that since the original post is over 3 1/2 years old, the OP has finished this project and has forgotten about it. Why did you waste your time commenting?

Similar Threads

  1. How to connect functions of QML files?
    By Yonetici in forum Qt Quick
    Replies: 2
    Last Post: 20th July 2012, 19:47
  2. Replies: 1
    Last Post: 15th August 2011, 23:26
  3. Replies: 3
    Last Post: 13th February 2011, 17:53
  4. Replies: 12
    Last Post: 17th June 2009, 05:34
  5. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 21:05

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.