[webkit-gtk] rendering a webpage to SVG

Ivan Klimek ivan at xclbr.com
Fri Aug 21 03:41:02 PDT 2020


Thanks for your great input Konstantin, sorry if I touched your feelings
but Qt Webkit is no longer officially maintained by Qt and as far I know -
from your own release notes - you ship with known unpatched vulnerabilities

I highly respect your efforts but being able to generate vector SVGs of
webpages using webkit-GTK would be clearly a more future-proof approach

Thank you
Ivan


On Fri, Aug 21, 2020 at 11:56 AM Konstantin Tokarev <annulen at yandex.ru>
wrote:

>
>
> 21.08.2020, 11:49, "Ivan Klimek" <ivan at xclbr.com>:
> > Hi Carlos,
> >
> > thanks for your fast reply
> >
> > not sure if this helps or if your question was addressed to me - from my
> *very* limited understanding - how its done its done in Qt - they have the
> qt_svg module that implements methods that directly write vectorized SVG
> elements:
> >
> > void drawEllipse(const QRectF &r) override;
> >
> > void drawPath(const QPainterPath &path) override;
> >
> > void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
> override;
> >
> > void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode
> mode) override;
> >
> > void drawRects(const QRectF *rects, int rectCount) override;
> >
> > void drawTextItem(const QPointF &pt, const QTextItem &item) override;
> >
> > void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
> >
> > Qt::ImageConversionFlags flags = Qt::AutoColor) override;
> >
> > see here: https://github.com/qt/qtsvg/blob/dev/src/svg/qsvggenerator.cpp
> >
> > from code its used like this:
> >
> >     QWebFrame *frame = m_page.mainFrame();
> >     QPainter painter;
> >     QSvgGenerator svg;
> >
> >     svg.setFileName(fileName);
> >     svg.setSize(resolution);
> >
> >     painter.begin(&svg);
> >
> >     frame->render(&painter);
> >
> > and that's all - output is vector SVG - every text / formatting etc all
> vector
> >
> > cairo is able to draw to SVG vectorized too, but the surface types need
> to be set correctly when drawing, I took a very light look at webkit-gtk
> cairo usage and cairo surface types are image types / aka bitmap so it
> draws stuff already to bitmap, and once in bitmap there is no way back :(
> but maybe I am reading this wrong, not sure
> >
> > *I do not know why this is done the way it is done in webkit-gtk, maybe
> it would be possible to just internally use svg surfaces?*
> >
> > would be epic if webkit-gtk could do something like that as Qt Webkit is
> dead and there are so many projects using this ...
>
> QtWebKit is not dead, I'm working on it.
> --
> Regards,
> Konstantin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20200821/a223bf95/attachment.htm>


More information about the webkit-gtk mailing list