[Interest] PDF to QByteArray

Jason H scorp1us at yahoo.com
Fri Feb 28 15:44:46 CET 2014


Yes, I know that there is more than outputting a blob to attach it to email.

My point was only that after the code I gave was executed, that the QByteArray should be the same size of the file.
If he was using the text flag to QFile::open() it could explain his issue. (EOF character in text mode)

Also as Till Oliver Knoll, points out, you can't trust the output of dDebug() with binary content. (0 value char ends the string)




________________________________
 From: Till Oliver Knoll <till.oliver.knoll at gmail.com>
To: Qt Project <interest at qt-project.org> 
Sent: Friday, February 28, 2014 9:17 AM
Subject: Re: [Interest] PDF to QByteArray
 


Am 28.02.2014 um 12:00 schrieb Jan Kundrát <jkt at flaska.net>:

On Friday, 28 February 2014 11:02:33 CEST, Till Oliver Knoll wrote:
>
>Or in just one line:
>>
>
>>
> QByteArray::toBase64() 
>>
>For the record, this is not enough -- the MIME standard imposes additional 
>restrictions, ...
>

Off course ;)

The point to be taken away was really just this: IF you assemble the mail body yourself, you can't simply write binary data into it (you need to encode it, with all the bells and whistles defined in RFC 2045).

Somehow the lines from an earlier post...

QByteArray ba_pdf = file.readAll();
>
qDebug() << ba_pdf;

... made me suspicioud that this is what is being attempted here.

Cheers,
  Oliver


_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140228/c37cdede/attachment.html>


More information about the Interest mailing list