I'm sorry I didn't remember the solution correctly and gave some wrong information. Basically this is how I got it solved:
painter.scale(5, 5); // scaling 5x
QImage scaled
= ScalePic
(pic,
QString("W"),
1600);
//this function uses scaletoWidth function and 1600 is PDF width / 5 painter.drawImage(20, 100, scaled); // using 1/5 coordinates due to 5x scaling
painter.scale(0.2, 0.2); // scaling set back to default so that following text prints can use the high resolution coordinates.
painter.scale(5, 5); // scaling 5x
QImage scaled = ScalePic(pic, QString("W"), 1600); //this function uses scaletoWidth function and 1600 is PDF width / 5
painter.drawImage(20, 100, scaled); // using 1/5 coordinates due to 5x scaling
painter.scale(0.2, 0.2); // scaling set back to default so that following text prints can use the high resolution coordinates.
To copy to clipboard, switch view to plain text mode
As a result the image quality is still very good for my purposes and the PDF size is a lot smaller, just like the pics were just 1/5 sized. Btw, I tried to use pics that were resized to the wanted size before using them in PDF, but it did not make any difference to the PDF size for some reason (pic size 7mb vs 250kb -> no difference).
Bookmarks