Home » U++ Library support » U++ Library : Other (not classified elsewhere) » PdfDraw, custom DPI request + my fix
Re: PdfDraw, custom DPI request + my fix [message #58827 is a reply to message #58818] |
Thu, 15 September 2022 10:59   |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
OK, that is misunderstanding and the problem is elsewhere.
Image::GetSize returns "pixel size" without taking account of DPI (or any other physical dimension).
Now there is Image::GetDots, which returns the size of image in "dots", where dot which is basically 600DPI pixel. Everything in U++ Draw related code that deals with physical dimensions is in dots, including all dimensions in PdfDraw.
Long story short, if you use GetDots instead of GetSize here, it will work as you needed.
Just for reference, to be sure I have tested with this code:
GUI_APP_MAIN
{
for(const char *fn : { "C:/upp/MyApps/6x9_300dpi.png", "C:/upp/MyApps/6x9_600dpi.png" }) {
Image img = StreamRaster::LoadFileAny(fn);
Size isz = img.GetDots();
DDUMP(isz);
PdfDraw draw(isz.cx, isz.cy);
draw.DrawImage(0, 0, isz.cx, isz.cy, img);
SaveFile("D:/xxx/" + GetFileTitle(fn) + ".pdf", draw.Finish());
}
}
|
|
|
 |
 |
PdfDraw, custom DPI request + my fix
|
 |
|
Re: PdfDraw, custom DPI request + my fix
By: Klugier on Mon, 22 August 2022 12:57
|
 |
|
Re: PdfDraw, custom DPI request + my fix
|
 |
|
Re: PdfDraw, custom DPI request + my fix
By: Mountacir on Wed, 14 September 2022 21:12
|
 |
|
Re: PdfDraw, custom DPI request + my fix
By: mirek on Thu, 15 September 2022 10:59
|
 |
|
Re: PdfDraw, custom DPI request + my fix
By: Mountacir on Thu, 15 September 2022 18:55
|
Goto Forum:
Current Time: Thu Aug 21 03:39:46 CEST 2025
Total time taken to generate the page: 0.05017 seconds
|