Customizable Print Formats GSoC 2015

Lubomir I. Ivanov neolit123 at gmail.com
Sat Mar 7 13:47:38 PST 2015


On 7 March 2015 at 23:21, Gehad Elrobey <gehadelrobey at gmail.com> wrote:
>
> I have tried to render a simple flow layout with QWebPage with Grantlee
> backend on Qt5, and the results seem ok I could even use some css3 effects
> and it rendered correctly. I attached a pdf with the output.
>

that's great progress,

i experimented myself a little and the results are promising.
these modern CSS things like "@page", and "@media print" really do
work, from my tests.
also, QWebPage translates nicely to physical dimensions (e.g. A4).

one thing to figure out is how are we going to embed the profile pictures...
if we are capturing the output of a QWebPage then we first need to
show the profiles in there.
for that <img src="data: metatype, base64, theDataGoesHere" /> can be used.

here is something you can try - it attempts to render a widget to a
SVG and loads it as base64 data via a <src> tag in a QWebView widget:

-----------------
#include <QSvgGenerator>

....

QByteArray byteArray;
QBuffer buffer(&byteArray);
QSvgGenerator svg;
svg.setOutputDevice(&buffer);
QPainter p;
p.begin(&svg);
someProfileWidget->render(&p);
p.end();

QString str = QString("<img src=\"data:image/svg;base64,") +
byteArray.toBase64() + "\"/>";

....

someWebView->showHtml(str);
------------------

the thing about QSvgGenerator is that i have no idea how well our
QGraphicsScene will translate to it.
also this probably going to be very slow!

QPicture we have no way to show in the HTML as it's a proprietary binary format.
QPixmaps are also doable (with QPixmap::save() and with data:image/png
), but we are not going to get vector profiles this way, i'd say.

i may be missing something in terms of what is best here.

lubomir
--

P.S.: use bottom posting, please:
http://en.wikipedia.org/wiki/Posting_style#Bottom-posting


More information about the subsurface mailing list