Unsolved A PDF viewer within PySide2?
-
@lolcocks
You will need a library for this. Google forqt5 view pdf
. I can see https://code.qt.io/cgit/qt-labs/qtpdf.git or https://poppler.freedesktop.org/. I cannot vouch for their support/suitability.Oh, I just saw you are PySide2. You may be out of luck....
An alternative is not to try to write the viewer yourself in Qt. Instead you can use
QtWebEngine
to navigate to a.pdf
file and that will show it. This is in a Chromium window (think Chrome web browser) window which can be displayed as a widget in your Qt app. It will need a plugin but I think will work. See https://doc.qt.io/qt-5/qtwebengine-features.html#pdf-file-viewing. Support for this feature was added in Qt 5.13.0. -
@JonB said in A PDF viewer within PySide2?:
@lolcocks
You will need a library for this. Google forqt5 view pdf
. I can see https://code.qt.io/cgit/qt-labs/qtpdf.git or https://poppler.freedesktop.org/. I cannot vouch for their support/suitability.Oh, I just saw you are PySide2. You may be out of luck....
An alternative is not to try to write the viewer yourself in Qt. Instead you can use
QtWebEngine
to navigate to a.pdf
file and that will show it. This is in a Chromium window (think Chrome web browser) window which can be displayed as a widget in your Qt app. It will need a plugin but I think will work. See https://doc.qt.io/qt-5/qtwebengine-features.html#pdf-file-viewing. Support for this feature was added in Qt 5.13.0.Hey, ummmm, sorry for the late reply but I got the time to work on this today.
So ummm, the problem being that I am trying to run this program on the Raspberry Pi and unfortunately, Raspberry Pi's PySide2 does not have QtWebEngine.Is there any other way I can make this work?
-
Guys I am trying to build PySide2 but I really lack Linux knowledge. What am I doing wrong here?
-
@lolcocks 1) I recommend creating a new thread as your problem has nothing to do with the initial problem. 2) Have you installed Qt5? If you have installed it then how have you done it? Where have you installed it?
-
@eyllanesc said in A PDF viewer within PySide2?:
@lolcocks 1) I recommend creating a new thread as your problem has nothing to do with the initial problem. 2) Have you installed Qt5? If you have installed it then how have you done it? Where have you installed it?
I am trying to build PySide2 from scratch because the current version on Raspian Buster does not have QtWebEngine which I need to make a PDF viewer. Which is why I posted in this thread. I know I should have been more elaborate but because of the lock down things have been really hectic and I am doing most of the work in the company as a lot of others had to be sent home because of the lock down. I typed that message rapidly and left to do some other important work.
@Denni-0 said in A PDF viewer within PySide2?:
@lolcocks are you tied heavily to the LGPL license? Which btw is not 100% LGPL from my understanding only limited scope of Qt objects are covered by the LGPL and GPL licenses. There is a web site that outlines what is and is not covered in Python-Qt (PyQt5 and PySide2) by the corresponding licenses and what is not
Honestly, the whole LGPL and GPL is getting so confusing.
Why is there no straight forward document from Qt that will tell me what is covered under LGPL, GPL and the commercial license.Forget Qt, even all the god damn websites tell me different things.
One says, if I don't modify the original Qt source code, I won't have to release my source code, other says that I will have to release my source code no matter what. Another website says LGPL does not require releasing of any kind of source code.This is straight up confusing and has actually wasted about a week's worth of time when I was deciding whether to use PyQt5 or PySide2. Eventually I settled for PySide2 because it's LGPL and now someone else comes in and tells me PySide2 is not entirely LGPL. Well if not, which components?
Someone at Qt really needs to clean up the air.
-
@lolcocks
I am not a lawyer.PySide2 is LGPL. PyQt5 is GPL.
and now someone else comes in and tells me PySide2 is not entirely LGPL
Ask them what parts of PySide2, as opposed to parts of Qt (which would equally apply to a C++ Qt program), are not LGPL.
A few Qt components --- nothing to do with C++/Python/PyQt/PySide2 --- are GPL not LGPL, such as QtCharts, but all the "normal" stuff is LGPL.
In the normal case I expect you to be in, you will not be altering Qt code itself. If you use PySide2 you will not have to release your source code. If you use PyQt5 you will have to release your source code (unless you pay for a licence from Riverbank.) So if you don't want to show your code, use PySide2. Of course, being Python it's a different matter whether all your Python code is going to be visible anyway....
There is also https://doc.qt.io/qtforpython/licenses.html, but I don't see anything there which has consequences for your source code. And for Qt there is https://doc.qt.io/qt-5/licenses-used-in-qt.html, but no relevance to PySide2 per se.
A not-bad summary is https://www.learnpyqt.com/blog/pyqt5-vs-pyside2/.
-
Thanks. I am definitely not going to be altering the original source code.
@Denni-0 , Sorry if I seemed mad. Things has been crazy frustrating since the lock down, all work has fallen onto me and as if quality of life wasn't already bad in India, it's been even worse since the lock down.
The only complex widget that I am going to be using is the QtWebEngine which I am not sure if comes under LGPL. Can someone please enlighten me whether this component is under which license?
-
@lolcocks
For QtWebEngine see https://doc.qt.io/qt-5/qtwebengine-licensing.html. It's still LGPL, as opposed to GPL. the summary is:The arguably most restrictive license to be respected by all users is LGPLv2.1.
I agree you might have to make your own judgment about Chromium, but again it is not a PySide2 issue.
-
@lolcocks 1) You have only answered point 1 of my previous comment. Any answer from the second point? 2) Always take the time to post the best possible comment to avoid unnecessary discussions, it is not necessary to respond quickly, but what you answer is complete. 3) On the other hand I recommend checking this thread to see if it is possible to compile pyside2 for RPI: https://bugreports.qt.io/browse/PYSIDE-802
-
@Denni-0 said in A PDF viewer within PySide2?:
@lolcocks no problems -- I do not make the rules -- I just try to shine the light on some of the more obscure ones
and yeah LGPL versus GPL are problematic to a degree -- although the simple answer is based on how do you answer this question?
Are you planning on making a end product that you plan to sell?
Answer: Yes
Solution: By a commercial licenseAnswer: No
Solution: Use GPL because if you do not sell it there really is nothing to enforceI get your point but for a third world country like mine with a really small company, $550 is quite high. Plus since the lockdown, the company is basically running on fumes. I don't think I am getting paid the next one or two months, but gonna stick with them cause the future seems promising for us.
I think I should be fine as Python's source code is open anyways and maybe I will tell the boss to allow me to put a copy of the source code on the website. Hopefully another large company won't rip it off.
@eyllanesc said in A PDF viewer within PySide2?:
@lolcocks 1) I recommend creating a new thread as your problem has nothing to do with the initial problem. 2) Have you installed Qt5? If you have installed it then how have you done it? Where have you installed it?
Apologies for not replying to the second part.
No. And yes, the error popped up cause I had not installed Qt5, I missed a step in the guide.Which I did later, but the problem was that the QtWebEngine cannot be compiled on the Raspberry Pi when compiling PySide2. It needs to be skipped, I think because of the 4GB RAM limit.
While researching yesterday, I read a comment on some website that his build of QtWebEngine was successful on a machine with 16 GB RAM but failed on a 12 GB RAM computer. Maybe I will try to build when I get a new computer with 16 GB RAM and then cross compile it.
Till then, getting back on the topic, I can convert the PDF to a image using pdf2image.
If I load the image into a label, can I make it scroll-able? Or using some other widget?
-
@lolcocks For small companies with <250k revenue you only have to pay 499$ per year.
See https://www.qt.io/buy-product/ (check "Our annual revenue/funding is <$250K" check box).Sorry, just noticed that you want to use PySide.
-
@jsulm said in A PDF viewer within PySide2?:
@lolcocks For small companies with <250k revenue you only have to pay 499$ per year.
See https://www.qt.io/buy-product/ (check "Our annual revenue/funding is <$250K" check box).Sorry, just noticed that you want to use PySide.
Our revenue is like 10000 to 20000 USD per year, most of which goes into salaries with very little left for development costs.
-
@lolcocks
You do not need to buy a commercial licence. Provided you are willing to abide by the LGPL of Qt5 & Pyside2, or the GPL of PyQt5 --- and I don't see that you have objected to these so far? --- so I don't know why you are worrying about commercial if you can't afford/don't want to buy it. -
@Denni-0 said in A PDF viewer within PySide2?:
Again you only need that commercial license if what you are building is going to be sold -- and if you are going to sell it posting the source code kind of defeats the purpose cause I can just go get your source code for free and use that.
So I am guessing you are not selling this software but using it -- if you are just using it -- as I stated the licenses are next to meaningless as there is nothing really to enforce -- it is primarily there to keep others from directly benefiting financially off of someone else's intellectual property by plagiarizing it.
So if you are just creating an application that the company plans to use internally or to use alongside something they do sell but is not an integral part of it then you should have no issues. So far it seems unclear to me what you are going to be doing with your end product that you are trying to make.
The application is going to be on a Raspberry Pi. The Raspberry Pi is going to have multiple temperature, flow and pressure sensors connected to it.
The Python code is going to sense the data from these sensors and display it to the user using the Qt framework.
The Raspberry Pi along with all the sensors is going to be sold as a whole product.
Is this the correct link for buying a commercial license?
https://www.riverbankcomputing.com/commercial/buy -
@lolcocks
Yes, that is the link to go buy commercial PyQt5 from Riverbank. To be clear, this is a commercial licence for PyQt only, not for Qt.Since you have decided to go commercial/closed source, you may also need to buy a commercial licence for Qt5 from Qt Company. https://www.qt.io/buy-product/. Go look at costs there, figure what you want, and total that with your PyQt licence if required before you start out.
Purely because I am interested, how are you intending to distribute your Python/PyQt application to conceal your Python source code?
-
@JonB said in A PDF viewer within PySide2?:
@lolcocks
Yes, that is the link to go buy commercial PyQt5 from Riverbank. To be clear, this is a commercial licence for PyQt only, not for Qt.Since you have decided to go commercial/closed source, you may also need to buy a commercial licence for Qt5 from Qt Company. https://www.qt.io/buy-product/. Go look at costs there, figure what you want, and total that with your PyQt licence if required before you start out.
Purely because I am interested, how are you intending to distribute your Python/PyQt application to conceal your Python source code?
Thanks, I will look into everything.
I was planning to use PyInstaller and / or PyArmor to conceal the Python code. But if the company cannot afford a Qt commercial license, I would have left it open.And regarding the actual topic for this thread, I am trying to cross compile Qt for the Raspberry Pi to get QtWebEngine working on the Raspberry Pi.
https://forum.qt.io/topic/114432/cross-compiling-qtwebengine-for-raspberry-pi