I was wondering if I could get QPrinter to output the resulting pdf/ps to a QIODevice as opposed to supplying a OutputFileName. I am doing a pdf creation and am unable to get access to the file system. I noticed in the class QPdfEngine (which is not part of the API) there is a method setIODevice(QIODevice *) which could possibly be called with a QBuffer.
Is there a way we can access this or would one have to add a method to QPrinter class (which would in turn call the print engine) and recompile Qt accordingly. Can one do this on a LGPL licence?
Maybe there is a better way of doing this...
Any help is appreciated.
any specific reason why you are not able to get access to file system?
I think you could just use QPainter, set the appropriate QPaintDevice and also accomplish what you want to do.
also from the docs:
The drawing capabilities of QPaintDevice are currently implemented by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and QPrinter subclasses.
To implement support for a new backend, you must derive from QPaintDevice and reimplement the virtual paintEngine() function to tell QPainter which paint engine should be used to draw on this particular device. Note that you also must create a corresponding paint engine to be able to draw on the device, i.e derive from QPaintEngine and reimplement its virtual functions.