[Qtwebengine] PDF/HTML -> SVG via QWebEngine + PDFium + Skia + SkCanvas + SkSVGCanvas?

Adam Twardoch (Lists) list.adam at twardoch.com
Sat Aug 25 01:18:10 CEST 2018


Hello all,

My understanding is that the QWebEngine project includes both the PDFium
PDF renderer and the Skia drawing library.

- https://pdfium.googlesource.com/pdfium/
- https://skia.org
- https://github.com/google/skia

PDFium has a Skia backend, which means that it can render a PDF onto an
SkCanvas canvas.

- https://pdfium.googlesource.com/pdfium/+/master/core/fxge/skia/
- https://skia.org/user/api/skcanvas_overview
-
https://github.com/amplab/ray-core/blob/master/src/examples/ui/pdf_viewer/pdf_viewer.cc

Skia has an SkSVGCanvas backend, which can render an SkCanvas into SVG.

- https://github.com/google/skia/tree/master/include/svg
- https://github.com/google/skia/tree/master/src/svg
- https://github.com/google/skia/blob/master/include/svg/SkSVGCanvas.h
- https://github.com/google/skia/blob/master/src/svg/SkSVGCanvas.cpp

Would it be possible to:

1. Render any QWebEngine view or page into SkCanvas and then into SVG?

If Qt were to do it, it could be exposed in an API similar to
QWebEnginePage::printToPdf. This would allow developers to render any web
content not just as a bitmap but also as an SVG, and then use one of the
many SVG processing methods to do something further with it.

2. "Convert" any PDF into SVG using that method?

Sinve QWebEngine can render PDF content into its view, it might be possible
to use the above method to end up with a PDF->SVG conversion, all using
on-board means with permissive licensing.

Regards,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20180825/9de01add/attachment.html>


More information about the QtWebEngine mailing list