[Interest] PDF to QByteArray

Marcelo Estanislau Geyer estanisgeyer at hotmail.com
Fri Feb 28 16:28:46 CET 2014


Thanks for all the answers. 


My problem is really with the POCO
library I'm using, I'll have to check that.


The output of qDebug left me confused and in
doubt, but I wrote this code confirmed
that Qt code was correct from the beginning:





QFile file("/home/marcelo/Documents/Test.pdf");


if (!file.open(QIODevice::ReadOnly)) {


    qDebug() << "file open error";


    return;


}





QByteArray ba_pdf = file.readAll();


file.close();





QFile f ("/home/marcelo/Documents/test_write.pdf");


if (!f.open(QIODevice::ReadWrite)) {


    qDebug() << "file write error";


    return;


}





QDataStream o(&f);


o << ba_pdf;


f.close();


return; 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140228/8d961b1c/attachment.html>


More information about the Interest mailing list