Merged Image Size

Hi,
I’m using the MergeImageField Event to bind images during mail merge process. Is there something like specific field name to define the image size ?
I think about something like “Image200x150:FIELDNAME”
Thanks for your work.
Tom.

Hi
Thanks for your inquiry. No there is no special fields to specify size of image. But I think that you can try specifying size during mail merge. You can resize image during inserting using the following code for example.

/// 
/// Resize source image to specifed sze
/// 
/// Source image
/// Target width
/// Target height
/// Resized image
public static Image ResizeImage(Image sourceImage, int targetWidth, int targetHeight)
{
    float ratioWidth = (float)sourceImage.Width / targetWidth;
    float ratioHeight = (float)sourceImage.Height / targetHeight;
    if (ratioWidth > ratioHeight)
        targetHeight = (int)(targetHeight * (ratioHeight / ratioWidth));
    else
    {
        if (ratioWidth < ratioHeight)
            targetWidth = (int)(targetWidth * (ratioWidth / ratioHeight));
    }
    // create target image
    Bitmap targetImage = new Bitmap(targetWidth, targetHeight, PixelFormat.Format24bppRgb);
    // set transform parameters 
    using (Graphics g = Graphics.FromImage(targetImage))
    {
        g.CompositingQuality = CompositingQuality.HighQuality;
        g.SmoothingMode = SmoothingMode.HighQuality;
        g.InterpolationMode = InterpolationMode.HighQualityBicubic;
        // resize image
        Rectangle rc = new Rectangle(0, 0, targetImage.Width, targetImage.Height);
        g.DrawImage(sourceImage, rc);
    }
    return (Image)targetImage;
}

Hope this helps.
Best regards.

Hi,
Thank you, but i already know how to resize images during mail merge. I whould known whether a specific syntax exists to allow resizing from the Word Template.
Then i will do it myself.
Best regards,
Tom.

Hi Alex,

I was trying to implement this solution for resizing the images but I am not able to bet the jar files or class files for the following objects:
Image
BitMap
Graphics

It will be really helpful if you can give me the links for downloading this jars, as they do not come with the standard JDK or JRE.

Thanks,
Saurabh

Hi Saurabh,
Thanks for your inquiry. I’m afraid these classes belong to the .NET framework and are not directly avaliable in Java.
Please try using the code in your other forum thread to resize images. If there are any problems with it we can extend on it to make it suitable for what you are looking for.
Thanks,