PDF with QWebView
I need to display a PDF in a QWebView. I already tried various solutions proposed in other topic but i could not make them work.
This is my code:
QString strUrl = QString("file:///C:/pdf/pdf-test.pdf");
QUrl xUrl (strUrl);
QWebSettings * pxWebSettings = QWebSettings::globalSettings();
N.B. m_pxRfmView is my QWebView and i user qt 5.3
I create QTWEBKIT_PLUGIN_PATH and MOZ_PLUGIN_PATH environmental variables with "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\Browser".
I create MY_APP/plugins folder and i put in nppdf32.dll (is the same dll that is presnet into "Acrobat Reader DC\Reader\Browser" directory.
I alo tried with QPrinter but doesn't work.
can someone help me?
Thanks in advanced!
one idea to also explicitly set the mime-type:
This has the disadvantage to load the whole PDF file into memory first. (Which is no problem for smaller sized PDF files.)
@raven-worx Thank you for reply.
I tried your solution but in my case doesn't work.
With my code or with your solution i see only the background (dark grey) . it seems that QWebView load the pdf file but it can't display
i would then expect a error message inside the PDF plugin?
But i don't know how the plugin behaves in such case.
One last try using HTML:
<object src="http://link.to/your.pdf" width="800" height="600" type='application/pdf'> <!---Fallback---> Can't display PDF file </object>
No error message.
Even with html doesn't works.
give some solution to resolve this issue.
@Gaurav-Badgujar At least a "Please" would be nice - we are not in army here and people do it in their own time for free.