You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a high-quality BSD-licensed PDFium parsing and rendering library, maintained by Google and originated at Foxkit:
[1]: https://pdfium.googlesource.com/pdfium/
Bundle Skia with the Qt app and use [the Skia backend of PDFium][8] to render the PDF via PDFium onto a Skia canvas, and then use [SkSVGCanvas][10] to generate an SVG from the Skia canvas, which then can be consumed by the Qt app. This would have the advantage of actually being free from any Qt dependencies, i.e. one could make a "sk-pdf2svg" commandline app that converts PDF to SVG via PDFium+Skia.
Bundle Skia with the Qt app, use [PDFium+Skia][8] to render the PDF via PDFium onto a Skia canvas, and then adapt [qt2skia][17] to do the reverse (translate Skia canvas API calls to QPainter API calls).
Skip Skia altogether, and develop a QPainter backend for PDFium modeled after [the Skia backend of PDFium][8].
If anyone is up to doing any of the above and publishes the results under a liberal opensource license, I’ll be most happy.
The text was updated successfully, but these errors were encountered:
Hi @twardoch, an interesting compilation! I would prefer to keep Qt as the only dependency so it would be better to user QPainter or QtSvg package. Feel free to contribute!
There is a high-quality BSD-licensed PDFium parsing and rendering library, maintained by Google and originated at Foxkit:
[1]: https://pdfium.googlesource.com/pdfium/
Qt has recently published a "labs module" to render a PDF into a QImage using the PDFium library:
[2]: http://blog.qt.io/blog/2017/01/30/new-qtpdf-qtlabs-module/
[3]: https://github.com/qt-labs/qtpdf
There is also another Qt-based similar project, QtPDFium:
[4]: https://github.com/paulovap/qtpdfium
There is also the Google Skia library, a performant 2D graphics library, also opensource:
[5]: https://skia.org
[6]: https://github.com/google/skia
[7]: https://skia.org/user/api/skcanvas
Now, PDFium has a Skia backend, which means that it can render a PDF onto an SkCanvas canvas:
[8]: https://pdfium.googlesource.com/pdfium/+/master/core/fxge/skia/
[9]: https://github.com/amplab/ray-core/blob/master/src/examples/ui/pdf_viewer/pdf_viewer.cc
And on the other hand, Skia has an SkSVGCanvas backend, which can render an SkCanvas into SVG:
[10]: https://github.com/google/skia/tree/master/include/svg
[11]: https://github.com/google/skia/tree/master/src/svg
[12]: https://github.com/google/skia/blob/master/include/svg/SkSVGCanvas.h
[13]: https://github.com/google/skia/blob/master/src/svg/SkSVGCanvas.cpp
And this seems to be a project that translates QPainter API calls to Skia API calls:
[14]: https://github.com/telishev/sneakPic/blob/master/src/renderer/qt2skia.h
[15]: https://github.com/telishev/sneakPic/blob/master/src/renderer/qt2skia.cpp
[16]: https://github.com/telishev/sneakPic
[17]: https://github.com/telishev/sneakPic/blob/master/src/renderer/renderer_item_svg.cpp
The
qt2skia.cpp
looks very trivial.There seem to be several options:
Bundle Skia with the Qt app and use [the Skia backend of PDFium][8] to render the PDF via PDFium onto a Skia canvas, and then use [SkSVGCanvas][10] to generate an SVG from the Skia canvas, which then can be consumed by the Qt app. This would have the advantage of actually being free from any Qt dependencies, i.e. one could make a "sk-pdf2svg" commandline app that converts PDF to SVG via PDFium+Skia.
Bundle Skia with the Qt app, use [PDFium+Skia][8] to render the PDF via PDFium onto a Skia canvas, and then adapt [qt2skia][17] to do the reverse (translate Skia canvas API calls to QPainter API calls).
Skip Skia altogether, and develop a QPainter backend for PDFium modeled after [the Skia backend of PDFium][8].
If anyone is up to doing any of the above and publishes the results under a liberal opensource license, I’ll be most happy.
The text was updated successfully, but these errors were encountered: