Android-PdfMyXml
Android-PdfMyXml copied to clipboard
Update Aspect Ratio Calculation on Images
I have updated the aspect ratio calculation method from
ar = page.getWidth() / image.getWidth();
to
float i_width = image.getWidth();
float i_height = image.getHeight();
if(i_width > i_height){
ar = page.getWidth() / i_width;
}else {
ar = page.getHeight() / i_height;
}
because if image height is greater than the width the updated method gives correct aspect ratio. Otherwise previous aspect ratio will give the value to fit in to width in every scenarios.
Thanks I will go over this the next couple of days
This has to be merged!
@vladimirarevshatyan have you tested it ?