+ Start a Discussion

visualforce dynamically resize image

Hi, i have a VFP rendered as PDF and i would like to dynamically resize the image in my VFP if the image exceed 200px width. if the image width is below 200px, i do not want to stretch the image to 200px, keep it as it is. is that possible?

i tried to set Style = "width 50%" but it will stretch the smaller size image which doesnt look good.
Jay GuruswamyJay Guruswamy
Hi HyLim1215,

<apex:image id="theImage" value="{!$Resource.Image1}"  width="250" height="50" alt="Description of image here"/>

Best Regards,
Hi Jay,

Thanks, but if my image's width is < 250 then it will stretch the image to fit the size which i dont want it, if the image is below the size, just keep as it is, only scale down the image if it exceed the size.

Jay GuruswamyJay Guruswamy
Hi, Below link will be helpful! https://developer.salesforce.com/forums/?id=906F0000000BaF6IAK Best Regards, Jay