问题
We are moving a large codebase from GDI to QPainter. One thing we used to get on Windows easily was the EMF clipboard format, which enabled customers to manipulate their pasted output in other programs (like Office) in a vector format.
It's easy for us to produce bitmaps from Qt into EMF, but that really doesn't give us back the editability of the old format. We can also make mime data from Postscript, which in some programs will retain vector format, but won't allow editability in Office, for example.
Since Trolltech/Nokia abandoned the GDI rendering path, is there any decent way to produce vector EMF output from QPainter? Options include 3rd-party libraries postprocessing other output formats (which we haven't seen usable results from), phony printer drivers (which introduce Windows-version specific issues). It has to work on WinXP -> 7.
Has anybody else solved this?
回答1:
Well, now I see that this has been asked and answered here before. The accepted answer there is that it can't be done easily. If anyone has any better news, I'd be happy to hear it.
回答2:
I have a PyQt QPaintEngine for rendering to EMF here (GPL): http://svn.gna.org/viewcvs/veusz/trunk/document/emf_export.py?view=markup
It also uses the PyEMF library. It would be hard to convert this to C++ if necessary.
回答3:
I just came across this possible solution: EmfEngine. I haven't used it, so YMMV.
来源:https://stackoverflow.com/questions/2013445/generate-vector-emf-wmf-windows-metafile-clipboard-content-from-qt-4-5