Has anyone here ever worked with QPrinter or QPdfWriter? I'm totally confused with all this QPainter stuff. All I want to do is to convert an SVG to PDF. I'm using SvgRenderer, which creates a Painter. But I don't know where to go from there. My small piece of code:
def convert(self):
file = "/home/ricardo/Imagens/desenho.svg"
svg = QSvgRenderer()
out = svg.load(file)
printer = QPrinter(out) # Am I mad? I suppose "out" is a QPainter.
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOutputFileName("/home/ricardo/Imagens/file.pdf") # I don't know what to do from here
20 June 2021
RicardoHas anyone here ever worked with QPrinter or QPdfWriter? I'm totally confused with all this QPainter stuff. All I want to do is to convert an SVG to PDF. I'm using SvgRenderer, which creates a Painter. But I don't know where to go from there. My small piece of code:
def convert(self):
f
Ссылка
click to show
click to show
RicardoHi, fellas! Now I can generate the PDF from the SVG, but the texts are missing. I'm able to use the same SVG and generate a PDF from Firefox. 🤔
You're missing some fonts package maybe, do a search on 'qt qprinter svg to pdf' there's someone talking about that
https://doc.qt.io/qt-5/svgrendering.html - "The Mobile SVG Profiles (SVG Basic and SVG Tiny) are aimed at resource-limited devices and are part of the 3GPP platform for third generation mobile phones." [...] "Qt supports the static features of SVG 1.2 Tiny. ECMA scripts and DOM manipulation are currently not supported."
at least that's what I got from https://lists.qt-project.org/pipermail/development/2021-June/041605.html
https://codereview.qt-project.org/q/project:qt/qtsvg+-owner:qt_submodule_update_bot%2540qt-project.org looks like there's some activity though (but mostly CI stuff)