Combine Multiple Images Into a Single PDF
-
@geor
hi
Sorry, didn't read the right docs.
The rect is for clipping not resize the widget.
So render will not help you to render it smaller.so yes, i guess to render it in different size, you must take widget out , call resize +render and put it back it.
Not sure how well it will work if there is other stuff in the layout.
If sole widget, it should work ok.wrote on 25 Jul 2016, 15:38 last edited by@mrjj Yeah I tried this method and It works but it's not perfect even if I resize the widget to the size of an A4 and then take it's pixmap fore some reason in the pdf it loses some quality (it looks a lot better in the user interface then in the pdf )even tho they are both the same size.I tried different functions from the painter class to draw the pixamp but the all seam the same not so good .If I draw the pixmap withouth any scaling it is very small in the pdf .. any ideas?
-
@mrjj Yeah I tried this method and It works but it's not perfect even if I resize the widget to the size of an A4 and then take it's pixmap fore some reason in the pdf it loses some quality (it looks a lot better in the user interface then in the pdf )even tho they are both the same size.I tried different functions from the painter class to draw the pixamp but the all seam the same not so good .If I draw the pixmap withouth any scaling it is very small in the pdf .. any ideas?
@geor
hi , have you tried to render it really large and then
scale down to fit A4? -
@geor
well a screen is 72/96 DPI
and a printer is 600/1200/2400 DPI
so images do get really small.As far as I remember, QPdfWriter have some setting for pdf resolution.
maybe it can produce better output. -
@geor
well a screen is 72/96 DPI
and a printer is 600/1200/2400 DPI
so images do get really small.As far as I remember, QPdfWriter have some setting for pdf resolution.
maybe it can produce better output. -
@geor
maybe you could try to scale it before
drawing it to pdf.
the scale function can be adjusted to aim for quality
http://doc.qt.io/qt-5/qpixmap.html#scaled
with Qt::SmoothTransformationnote. it returns the scaled pixmap not modify the original.
so something like
mypixmap = mypixmap.scaled(xx) -
@geor
maybe you could try to scale it before
drawing it to pdf.
the scale function can be adjusted to aim for quality
http://doc.qt.io/qt-5/qpixmap.html#scaled
with Qt::SmoothTransformationnote. it returns the scaled pixmap not modify the original.
so something like
mypixmap = mypixmap.scaled(xx) -
@geor
well it was worth a shot.
I assume you play around with different scales?
Have you tried huge image like 1920x1080 and scale it down?
You are using http://doc.qt.io/qt-5/qpaintdevice.html#logicalDpiX
to calc how much to scale it?I dont remember quality being so bad but i was using a fairly
large resolution so the widget was not that small. -
@geor
well it was worth a shot.
I assume you play around with different scales?
Have you tried huge image like 1920x1080 and scale it down?
You are using http://doc.qt.io/qt-5/qpaintdevice.html#logicalDpiX
to calc how much to scale it?I dont remember quality being so bad but i was using a fairly
large resolution so the widget was not that small.wrote on 25 Jul 2016, 19:08 last edited by@mrjj yes I am using it the quality is not so good however if I save it into an image its gives me a good quality so it seems taking an image instead of a pixmap a lot better.
just like this
ui->myWidget->grab().save("image.png");
but this make me save 5 usless Images and I could not find a way to just use it temporarly.. -
@mrjj yes I am using it the quality is not so good however if I save it into an image its gives me a good quality so it seems taking an image instead of a pixmap a lot better.
just like this
ui->myWidget->grab().save("image.png");
but this make me save 5 usless Images and I could not find a way to just use it temporarly..@geor
Im not sure what grab() is.
Does it return QImage?
Im wondering if u could just draw this directly?
No reason to save first. -
@geor
Im not sure what grab() is.
Does it return QImage?
Im wondering if u could just draw this directly?
No reason to save first. -
@geor
have you tried to convert to qimage and draw it?
http://doc.qt.io/qt-4.8/qpixmap.html#toImage
Not sure why saving as png makes any difference. -
wrote on 12 Jul 2017, 01:23 last edited byThis post is deleted!
-
wrote on 24 Apr 2018, 13:58 last edited by JonB
@MarieBurgan
Thanks for the plug. I'm sure @geor will thank you for this tip, if he visits here now two years after he last posted... ;-) -
P Pl45m4 referenced this topic on 27 Apr 2023, 13:31