Hi, I am modifying the QPrinter engine for the generation of Pdf because I want to include the original image file in the PDF and not a re-compressed copy of the image. The image written in a PDF is saved in a QByteArray compressed. The original code is the following:
Qt Code:
  1. QBuffer buffer(&imageData);
  2. QImageWriter writer(&buffer, "jpeg");
  3. writer.setQuality(94);
  4. writer.write(img);
To copy to clipboard, switch view to plain text mode 
where "img" is the QImage to write on the PDF doc and "imageData" is the QByteArray that will be fisically written in the PDF doc calling to "writeImage". Well, I want to change the code above with the following:
Qt Code:
  1. QFile fitxerImatge(pathImatge);
  2. imageData = fitxerImatge.readAll();
To copy to clipboard, switch view to plain text mode 
where "pathImatge" is the path to the original image file. The problem is that no images are written in the PDF doc with the second code and when I openit with Adobe Acrobat Reader it says that "There isn't enough data for the image". I've checked that the path is correct and, moreover, the original image file contains a JPEG image created with Qt. So, I don't know where's the problem. Could you suggest me something, please?