PDA

View Full Version : View PDF from Qt application



jvdl
4th February 2010, 10:02
Hello,

I have the following problem: I want to make a commercial application from which I can view certain PDF documents. The application will be the only program the user can run. It will launch on system startup and keeps the user within the application. For the PDF documents, I found several options, but they all have problems:

Use Poppler library. This is a great library to view PDF files from within the Qt application. Only problem: it is GPL licensed, so I cannot use it (link dynamically to it) without opening my source (which I don't want).
Launch a PDF viewer from the Qt application. This way I can keep my own code closed source. But now I lose control. The user will be able to minimize the PDF viewer and launch multiple instances of it.
Convert the PDF documents to HTML. This way I could use the Qt WebKit and keep the user within the application. But now I run into the problem finding a good PDF to HTML converter. I doubt if there are any.


Of course, my question is: does anyone have a solution for this problem?

Thanks in advance!

Joost

high_flyer
4th February 2010, 11:34
Use Poppler library. This is a great library to view PDF files from within the Qt application. Only problem: it is GPL licensed, so I cannot use it (link dynamically to it) without opening my source (which I don't want).
This is not quite true.
GPL means, that you have to make the GPL'ed code available, or if you made changes to it the GPL'ed code, but not your own application.
However, the GPL community is not quite clear on this.
Check the license again and read it through - if you only link to the library, AFAIK - you can ship the lib code with your application, and have your application closed.
(http://en.wikipedia.org/wiki/GNU_General_Public_License look for "Linking and derived works").
Probably, if you contact the author, and ask him for permission to link against the lib, without making changes to it, he will agree to allow you use it in a commercial application, asking might be worth while.

jvdl
4th February 2010, 12:46
Thanks for your answer.

Indeed, I red this wikipedia page and it suggests that I could use the library. Also, if I look at http://en.wikipedia.org/wiki/Library_%28computing%29#Dynamic_linking it says:

The nature of dynamic linking makes it a common place beyond which someone who grants a software licenseGPL linking exception allows programs to use libraries available under GPL licenses without themselves becoming subject to the full terms of the GPL as a result.

But then again, if I read on http://www.gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins is see:

If the program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single program, which must be treated as an extension of both the main program and the plug-ins. In order to use the GPL-covered plug-ins, the main program must be released under the GPL or a GPL-compatible free software license, and that the terms of the GPL must be followed when the main program is distributed for use with these plug-ins.

So now I am not sure any more..... :(

I have send the author an email, but no answer yet...

Joost

squidge
4th February 2010, 12:46
Check the license again and read it through - if you only link to the library, AFAIK - you can ship the lib code with your application, and have your application closed.Isn't that the point of the LGPL? If an app ships with just GPL (not LGPL), then you can't even link against it AFAIK if the two codes share data structure between them, as they are regarded as one.

high_flyer
4th February 2010, 13:21
The problem is that its not clear cut case.
The GPL community is spilt on this, and there is no one answer which is considered as the "correct" one.
Which is why I suggested to you to contact the author of the lib directly, and get a permission from him, then you are on the clear.

jvdl
5th February 2010, 11:00
Hi again. I got an answer from the maintainer of Poppler:

Well, this is my opinion as poppler maintainer, your program while using the GPL code of poppler falls under derivative work of poppler and thus should be released under the GPL too.
Of course i'm not a lawyer so you should hire one if you want to get your back covered.

I think that this is the best answer. Of course, this also goes for Qt itself. Just look at the "License Comparison Table" on http://qt.nokia.com/products/licensing. If I could create closed source applications which dynamically link to the GPL licensed Qt library, what good would the LGPL licence be??

For the PDF problem I found another solution: converting to HTML gives a bad result. But an alternative is converting the PDF file to images (for example with pdftoppm). Ok, I lose the option to search. And the files are a lot bigger (about 50 times). But images are easily handled within Qt of course, and hard-disk space is not really a big problem in these days.

Joost